<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width">
<meta name="theme-color" content="#222"><meta name="generator" content="Hexo 7.3.0">

  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png">
  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32.ico">
  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16.ico">
  <link rel="mask-icon" href="/images/logo.svg" color="#222">

<link rel="stylesheet" href="/css/main.css">



<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css" integrity="sha256-wiz7ZSCn/btzhjKDQBms9Hx4sSeUYsDrTLg7roPstac=" crossorigin="anonymous">
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.1.1/animate.min.css" integrity="sha256-PR7ttpcvz8qrF57fur/yAx1qXMFJeJFiA6pSzWi0OIE=" crossorigin="anonymous">
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/fancyapps-ui/5.0.28/fancybox/fancybox.css" integrity="sha256-6cQIC71/iBIYXFK+0RHAvwmjwWzkWd+r7v/BX3/vZDc=" crossorigin="anonymous">
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/pace/1.2.4/themes/green/pace-theme-minimal.css">
  <script src="https://cdnjs.cloudflare.com/ajax/libs/pace/1.2.4/pace.min.js" integrity="sha256-gqd7YTjg/BtfqWSwsJOvndl0Bxc8gFImLEkXQT8+qj0=" crossorigin="anonymous"></script>

<script class="next-config" data-name="main" type="application/json">{"hostname":"sumumm.github.io","root":"/","images":"/images","scheme":"Gemini","darkmode":false,"version":"8.19.2","exturl":false,"sidebar":{"position":"left","display":"post","padding":18,"offset":12},"copycode":{"enable":true,"style":"mac"},"fold":{"enable":true,"height":300},"bookmark":{"enable":false,"color":"#222","save":"auto"},"mediumzoom":false,"lazyload":true,"pangu":false,"comments":{"style":"tabs","active":null,"storage":true,"lazyload":false,"nav":null},"stickytabs":false,"motion":{"enable":true,"async":true,"transition":{"menu_item":"fadeInDown","post_block":"fadeIn","post_header":"fadeInDown","post_body":"fadeInDown","coll_header":"fadeInLeft","sidebar":"fadeInUp"}},"i18n":{"placeholder":"搜索...","empty":"没有找到任何搜索结果：${query}","hits_time":"找到 ${hits} 个搜索结果（用时 ${time} 毫秒）","hits":"找到 ${hits} 个搜索结果"},"path":"/search.xml","localsearch":{"enable":true,"trigger":"auto","top_n_per_article":1,"unescape":false,"preload":false}}</script><script src="/js/config.js"></script>

    <meta name="description" content="本文主要是体验正点原子I.MX6U-ALPHA开发板出厂系统——NXP官方烧写工具mfgtool的相关笔记，若笔记中有错误或者不合适的地方，欢迎批评指正😃。">
<meta property="og:type" content="article">
<meta property="og:title" content="LV01-02-IMX6ULL-ALPHA开发板体验-02-NXP-mfgtool简介">
<meta property="og:url" content="https://sumumm.github.io/post/95616702.html">
<meta property="og:site_name" content="苏木">
<meta property="og:description" content="本文主要是体验正点原子I.MX6U-ALPHA开发板出厂系统——NXP官方烧写工具mfgtool的相关笔记，若笔记中有错误或者不合适的地方，欢迎批评指正😃。">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-02-NXP-mfgtool%E7%AE%80%E4%BB%8B/img/image-20230713074739385.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-02-NXP-mfgtool%E7%AE%80%E4%BB%8B/img/image-20241103215738343.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-02-NXP-mfgtool%E7%AE%80%E4%BB%8B/img/image-20241103215954270.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-02-NXP-mfgtool%E7%AE%80%E4%BB%8B/img/image-20241103221624913.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-02-NXP-mfgtool%E7%AE%80%E4%BB%8B/img/image-20240525164855977.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-02-NXP-mfgtool%E7%AE%80%E4%BB%8B/img/image-20240525165007553.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-02-NXP-mfgtool%E7%AE%80%E4%BB%8B/img/image-20221023135227789.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-02-NXP-mfgtool%E7%AE%80%E4%BB%8B/img/image-20221023135252376.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-02-NXP-mfgtool%E7%AE%80%E4%BB%8B/img/image-20221023135357169.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-02-NXP-mfgtool%E7%AE%80%E4%BB%8B/img/image-20221023135529577.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-02-NXP-mfgtool%E7%AE%80%E4%BB%8B/img/image-20221023135644384.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-02-NXP-mfgtool%E7%AE%80%E4%BB%8B/img/image-20221023140005355.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-02-NXP-mfgtool%E7%AE%80%E4%BB%8B/img/f_fd7ba6ea8122dfb5e44d51f14e840260&t=jpg&o=&s=&v=1584696067.jpeg">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-02-NXP-mfgtool%E7%AE%80%E4%BB%8B/img/image-20241104223009081.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-02-NXP-mfgtool%E7%AE%80%E4%BB%8B/img/image-20241104074701149.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-02-NXP-mfgtool%E7%AE%80%E4%BB%8B/img/image-20241104232733823.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-02-NXP-mfgtool%E7%AE%80%E4%BB%8B/img/image-20241104234003124.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-02-NXP-mfgtool%E7%AE%80%E4%BB%8B/img/image-20241104234352843.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-02-NXP-mfgtool%E7%AE%80%E4%BB%8B/img/image-20241104234816747.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-02-NXP-mfgtool%E7%AE%80%E4%BB%8B/img/image-20241105000348103.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-02-NXP-mfgtool%E7%AE%80%E4%BB%8B/img/image-20241105065317996.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-02-NXP-mfgtool%E7%AE%80%E4%BB%8B/img/v2-6160f8710a2afd2e8c8ee267b8427c78_1440w.jpeg">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-02-NXP-mfgtool%E7%AE%80%E4%BB%8B/img/image-20241105065429877.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-02-NXP-mfgtool%E7%AE%80%E4%BB%8B/img/image-20241105071304417.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-02-NXP-mfgtool%E7%AE%80%E4%BB%8B/img/image-20241105071750420.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-02-NXP-mfgtool%E7%AE%80%E4%BB%8B/img/image-20230714181213952.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-02-NXP-mfgtool%E7%AE%80%E4%BB%8B/img/image-20230714181753981.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-02-NXP-mfgtool%E7%AE%80%E4%BB%8B/img/image-20230714181855110.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-02-NXP-mfgtool%E7%AE%80%E4%BB%8B/img/image-20230714182112631.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-02-NXP-mfgtool%E7%AE%80%E4%BB%8B/img/image-20221023145536704.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-02-NXP-mfgtool%E7%AE%80%E4%BB%8B/img/image-20230714183618441.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-02-NXP-mfgtool%E7%AE%80%E4%BB%8B/img/image-20230714183832269.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-02-NXP-mfgtool%E7%AE%80%E4%BB%8B/img/image-20230715090438259.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-02-NXP-mfgtool%E7%AE%80%E4%BB%8B/img/image-20230715095029133.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-02-NXP-mfgtool%E7%AE%80%E4%BB%8B/img/image-20230715095123022.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-02-NXP-mfgtool%E7%AE%80%E4%BB%8B/img/image-20221023154920830.png">
<meta property="og:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-02-NXP-mfgtool%E7%AE%80%E4%BB%8B/img/image-20230715102654342.png">
<meta property="article:published_time" content="2023-09-08T11:25:26.000Z">
<meta property="article:modified_time" content="2025-06-13T16:25:57.030Z">
<meta property="article:author" content="苏木">
<meta property="article:tag" content="(ALPHA)LV01-IMX6ULL平台">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-02-NXP-mfgtool%E7%AE%80%E4%BB%8B/img/image-20230713074739385.png">


<link rel="canonical" href="https://sumumm.github.io/post/95616702.html">



<script class="next-config" data-name="page" type="application/json">{"sidebar":"","isHome":false,"isPost":true,"lang":"zh-CN","comments":true,"permalink":"https://sumumm.github.io/post/95616702.html","path":"post/95616702.html","title":"LV01-02-IMX6ULL-ALPHA开发板体验-02-NXP-mfgtool简介"}</script>

<script class="next-config" data-name="calendar" type="application/json">""</script>
<title>LV01-02-IMX6ULL-ALPHA开发板体验-02-NXP-mfgtool简介 | 苏木</title>
  








    <script src="/js/browser_tools_disable.js"></script>

  <noscript>
    <link rel="stylesheet" href="/css/noscript.css">
  </noscript>
<!-- hexo injector head_end start --><link rel="stylesheet" href="https://unpkg.com/hexo-next-tags-plus@latest/lib/tag_plus.css" media="defer" onload="this.media='all'"><!-- hexo injector head_end end --></head>

<body itemscope itemtype="http://schema.org/WebPage" class="use-motion">
  <div class="headband"></div>

  <main class="main">
    <div class="column">
      <header class="header" itemscope itemtype="http://schema.org/WPHeader"><div class="site-brand-container">
  <div class="site-nav-toggle">
    <div class="toggle" aria-label="切换导航栏" role="button">
        <span class="toggle-line"></span>
        <span class="toggle-line"></span>
        <span class="toggle-line"></span>
    </div>
  </div>

  <div class="site-meta">

    <a href="/" class="brand" rel="start">
      <i class="logo-line"></i>
      <p class="site-title">苏木</p>
      <i class="logo-line"></i>
    </a>
      <p class="site-subtitle" itemprop="description">我的学习之路</p>
  </div>

  <div class="site-nav-right">
    <div class="toggle popup-trigger" aria-label="搜索" role="button">
        <i class="fa fa-search fa-fw fa-lg"></i>
    </div>
  </div>
</div>



<nav class="site-nav">
  <ul class="main-menu menu"><li class="menu-item menu-item-home"><a href="/" rel="section"><i class="fa fa-home fa-fw"></i>苏木的家</a></li><li class="menu-item menu-item-categories"><a href="/categories/" rel="section"><i class="fa fa-th fa-fw"></i>分类页<span class="badge">42</span></a></li><li class="menu-item menu-item-archives"><a href="/archives/" rel="section"><i class="fa fa-archive fa-fw"></i>归档页<span class="badge">673</span></a></li><li class="menu-item menu-item-flink"><a href="/flink/" rel="section"><i class="fa fa-link fa-fw"></i>友人帐</a></li><li class="menu-item menu-item-about"><a href="/about/" rel="section"><i class="fa fa-user fa-fw"></i>关于我</a></li>
      <li class="menu-item menu-item-search">
        <a role="button" class="popup-trigger"><i class="fa fa-search fa-fw"></i>搜索
        </a>
      </li>
  </ul>
</nav>



  <div class="search-pop-overlay">
    <div class="popup search-popup"><div class="search-header">
  <span class="search-icon">
    <i class="fa fa-search"></i>
  </span>
  <div class="search-input-container">
    <input autocomplete="off" autocapitalize="off" maxlength="80"
           placeholder="搜索..." spellcheck="false"
           type="search" class="search-input">
  </div>
  <span class="popup-btn-close" role="button">
    <i class="fa fa-times-circle"></i>
  </span>
</div>
<div class="search-result-container no-result">
  <div class="search-result-icon">
    <i class="fa fa-spinner fa-pulse fa-5x"></i>
  </div>
</div>

    </div>
  </div>

</header>
        
  
  <aside class="sidebar">

    <div class="sidebar-inner sidebar-nav-active sidebar-toc-active">
      <ul class="sidebar-nav">
        <li class="sidebar-nav-toc">
          文章目录
        </li>
        <li class="sidebar-nav-overview">
          站点概览
        </li>
      </ul>

      <div class="sidebar-panel-container">
        <!--noindex-->
        <div class="post-toc-wrap sidebar-panel">
            <div class="post-toc animated"><ol class="nav"><li class="nav-item nav-level-1"><a class="nav-link" href="#%E4%B8%80%E3%80%81mfgtool%E7%83%A7%E5%86%99%E5%B7%A5%E5%85%B7"><span class="nav-text">一、mfgtool烧写工具</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#1-ALPHA%E6%9D%BF%E5%BC%80%E5%8F%91%E8%B5%84%E6%96%99%E4%B8%AD%E7%9A%84mfgtool"><span class="nav-text">1. ALPHA板开发资料中的mfgtool</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#2-NXP%E5%AE%98%E6%96%B9%E5%8E%9F%E7%89%88mfgtool"><span class="nav-text">2. NXP官方原版mfgtool</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#2-1-%E8%BD%AF%E4%BB%B6%E4%B8%8B%E8%BD%BD"><span class="nav-text">2.1 软件下载</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#2-2-%E7%9B%B8%E5%85%B3%E4%BB%8B%E7%BB%8D"><span class="nav-text">2.2 相关介绍</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#3-mfgtool%E5%90%AF%E5%8A%A8"><span class="nav-text">3. mfgtool启动</span></a></li></ol></li><li class="nav-item nav-level-1"><a class="nav-link" href="#%E4%BA%8C%E3%80%81%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99%E5%8E%9F%E7%90%86"><span class="nav-text">二、系统烧写原理</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#1-%E7%83%A7%E5%86%99%E6%B5%81%E7%A8%8B%E6%A6%82%E8%BF%B0"><span class="nav-text">1. 烧写流程概述</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#1-1-%E4%B8%A4%E4%B8%AA%E9%98%B6%E6%AE%B5"><span class="nav-text">1.1 两个阶段</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#1-2-%E8%BF%9E%E6%8E%A5%E5%90%8E%E5%8F%91%E7%94%9F%E4%BA%86%E4%BB%80%E4%B9%88%EF%BC%9F"><span class="nav-text">1.2 连接后发生了什么？</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#2-OS-Firmware%E7%9B%AE%E5%BD%95%E8%AF%B4%E6%98%8E"><span class="nav-text">2. OS Firmware目录说明</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#2-1-firmware%E7%9B%AE%E5%BD%95"><span class="nav-text">2.1 firmware目录</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#2-2-files%E7%9B%AE%E5%BD%95"><span class="nav-text">2.2 files目录</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#2-3-ucl2-xml-%E6%96%87%E4%BB%B6"><span class="nav-text">2.3 ucl2.xml 文件  </span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#2-3-1-%E6%95%B4%E4%BD%93%E6%A1%86%E6%9E%B6"><span class="nav-text">2.3.1 整体框架</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#2-3-2-UCL%E6%A0%87%E7%AD%BE"><span class="nav-text">2.3.2 UCL标签</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#2-3-3-CFG%E6%A0%87%E7%AD%BE"><span class="nav-text">2.3.3 CFG标签</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#2-3-4-LIST%E6%A0%87%E7%AD%BE"><span class="nav-text">2.3.4 LIST标签</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#2-3-5-CMD%E6%A0%87%E7%AD%BE"><span class="nav-text">2.3.5 CMD标签</span></a><ol class="nav-child"><li class="nav-item nav-level-5"><a class="nav-link" href="#2-3-5-1-%E4%B8%A4%E7%A7%8D%E5%91%BD%E4%BB%A4"><span class="nav-text">2.3.5.1 两种命令</span></a></li><li class="nav-item nav-level-5"><a class="nav-link" href="#2-3-5-2-%E6%96%87%E4%BB%B6%E5%8C%B9%E9%85%8D"><span class="nav-text">2.3.5.2 文件匹配</span></a></li></ol></li></ol></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#3-xxx-vbs%E6%96%87%E4%BB%B6"><span class="nav-text">3. xxx.vbs文件</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#4-UICfg-ini%E6%96%87%E4%BB%B6"><span class="nav-text">4. UICfg.ini文件</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#5-cfg-ini%E6%96%87%E4%BB%B6"><span class="nav-text">5. cfg.ini文件</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#6-%E7%83%A7%E5%86%99%E8%BF%87%E7%A8%8B%E5%88%86%E6%9E%90"><span class="nav-text">6. 烧写过程分析</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#6-1-%E5%8F%82%E6%95%B0%E9%85%8D%E7%BD%AE"><span class="nav-text">6.1 参数配置</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#6-2-CFG"><span class="nav-text">6.2 CFG</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#6-3-LIST"><span class="nav-text">6.3 LIST</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#6-4-CMD%E2%80%94%E2%80%94BootStrap"><span class="nav-text">6.4 CMD——BootStrap</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#6-4-1-BootStrap%E2%80%94%E2%80%94uboot"><span class="nav-text">6.4.1 BootStrap——uboot</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#6-4-2-BootStarp%E2%80%94%E2%80%94kernel"><span class="nav-text">6.4.2 BootStarp——kernel</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#6-4-3-BootStrap%E2%80%94%E2%80%94Initramfs"><span class="nav-text">6.4.3 BootStrap——Initramfs</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#6-4-4-BootStrap%E2%80%94%E2%80%94device-tree"><span class="nav-text">6.4.4 BootStrap——device tree</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#6-4-5-BootStrap%E2%80%94%E2%80%94jump"><span class="nav-text">6.4.5 BootStrap——jump</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#6-5-CMD%E2%80%94%E2%80%94Updater"><span class="nav-text">6.5 CMD——Updater</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#6-5-1-Updater%E2%80%94%E2%80%94create-partition"><span class="nav-text">6.5.1 Updater——create partition</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#6-5-2-Updater%E2%80%94%E2%80%94burn-uboot"><span class="nav-text">6.5.2 Updater——burn uboot</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#6-5-3-Updater%E2%80%94%E2%80%94create-fat-partition"><span class="nav-text">6.5.3 Updater——create fat partition</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#6-5-4-Updater%E2%80%94%E2%80%94burn-zImage"><span class="nav-text">6.5.4 Updater——burn zImage</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#6-5-5-Updater%E2%80%94%E2%80%94burn-dtb"><span class="nav-text">6.5.5 Updater——burn dtb</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#6-5-6-Updater%E2%80%94%E2%80%94burn-m4-demo-bins"><span class="nav-text">6.5.6 Updater——burn m4 demo bins</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#6-5-7-Updater%E2%80%94%E2%80%94burn-rootfs"><span class="nav-text">6.5.7 Updater——burn rootfs</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#6-5-8-Updater%E2%80%94%E2%80%94%E6%80%BB%E7%BB%93"><span class="nav-text">6.5.8 Updater——总结</span></a></li></ol></li></ol></li></ol></li><li class="nav-item nav-level-1"><a class="nav-link" href="#%E4%B8%89%E3%80%81NXP%E5%AE%98%E6%96%B9%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99"><span class="nav-text">三、NXP官方系统烧写</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#1-%E7%B3%BB%E7%BB%9F%E7%83%A7%E5%86%99%E5%88%B0EMMC"><span class="nav-text">1. 系统烧写到EMMC</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#2-%E9%87%8D%E5%90%AF%E6%B5%8B%E8%AF%95"><span class="nav-text">2. 重启测试</span></a></li></ol></li><li class="nav-item nav-level-1"><a class="nav-link" href="#%E5%9B%9B%E3%80%81%E6%94%B9%E9%80%A0%E8%87%AA%E5%B7%B1%E7%9A%84%E7%83%A7%E5%86%99%E5%B7%A5%E5%85%B7%EF%BC%9F"><span class="nav-text">四、改造自己的烧写工具？</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#1-%E5%87%86%E5%A4%87%E5%B7%A5%E5%85%B7%E7%9B%AE%E5%BD%95"><span class="nav-text">1. 准备工具目录</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#2-%E6%96%87%E4%BB%B6%E5%87%86%E5%A4%87"><span class="nav-text">2. 文件准备</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#2-1-files%E7%9B%AE%E5%BD%95%E6%96%87%E4%BB%B6"><span class="nav-text">2.1 files目录文件</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#2-2-firmware%E7%9B%AE%E5%BD%95%E6%96%87%E4%BB%B6"><span class="nav-text">2.2 firmware目录文件</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#2-3-%E6%96%B0%E5%BB%BA-vbs-%E6%96%87%E4%BB%B6"><span class="nav-text">2.3 新建 .vbs 文件</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#2-4-%E6%96%B0%E5%BB%BA-ucl2-xml-%E6%96%87%E4%BB%B6"><span class="nav-text">2.4 新建 ucl2.xml 文件</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#3-%E7%83%A7%E5%86%99%E6%B5%8B%E8%AF%95"><span class="nav-text">3. 烧写测试</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#4-%E9%87%8D%E5%90%AF%E6%B5%8B%E8%AF%95"><span class="nav-text">4. 重启测试</span></a></li></ol></li></ol></div>
        </div>
        <!--/noindex-->

        <div class="site-overview-wrap sidebar-panel">
          <div class="site-author animated" itemprop="author" itemscope itemtype="http://schema.org/Person">
    <img class="site-author-image" itemprop="image" alt="苏木"
      src="/images/avatar.jpg">
  <p class="site-author-name" itemprop="name">苏木</p>
  <div class="site-description" itemprop="description">莫道桑榆晚，为霞尚满天</div>
</div>
<div class="site-state-wrap animated">
  <nav class="site-state">
      <div class="site-state-item site-state-posts">
        <a href="/archives/">
          <span class="site-state-item-count">673</span>
          <span class="site-state-item-name">日志</span>
        </a>
      </div>
      <div class="site-state-item site-state-categories">
          <a href="/categories/">
        <span class="site-state-item-count">42</span>
        <span class="site-state-item-name">分类</span></a>
      </div>
      <div class="site-state-item site-state-tags">
        <span class="site-state-item-count">43</span>
        <span class="site-state-item-name">标签</span>
      </div>
  </nav>
</div>
  <div class="links-of-author animated">
      <span class="links-of-author-item">
        <a href="https://github.com/sumumm" title="GitHub → https:&#x2F;&#x2F;github.com&#x2F;sumumm" rel="noopener me" target="_blank"><i class="fab fa-github fa-fw"></i>GitHub</a>
      </span>
  </div>

        </div>
      </div>
    </div>

    
  </aside>


    </div>

    <div class="main-inner post posts-expand">


  


<div class="post-block">
  
  

  <article itemscope itemtype="http://schema.org/Article" class="post-content" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="https://sumumm.github.io/post/95616702.html">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/avatar.jpg">
      <meta itemprop="name" content="苏木">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="苏木">
      <meta itemprop="description" content="莫道桑榆晚，为霞尚满天">
    </span>

    <span hidden itemprop="post" itemscope itemtype="http://schema.org/CreativeWork">
      <meta itemprop="name" content="LV01-02-IMX6ULL-ALPHA开发板体验-02-NXP-mfgtool简介 | 苏木">
      <meta itemprop="description" content="">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">
          LV01-02-IMX6ULL-ALPHA开发板体验-02-NXP-mfgtool简介
        </h1>

        <div class="post-meta-container">
          <div class="post-meta">
    <span class="post-meta-item">
      <span class="post-meta-item-icon">
        <i class="far fa-calendar"></i>
      </span>
      <span class="post-meta-item-text">发表于</span>

      <time title="创建时间：2023-09-08 19:25:26" itemprop="dateCreated datePublished" datetime="2023-09-08T19:25:26+08:00">2023-09-08</time>
    </span>
    <span class="post-meta-item">
      <span class="post-meta-item-icon">
        <i class="far fa-folder"></i>
      </span>
      <span class="post-meta-item-text">分类于</span>
        <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
          <a href="/categories/%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/" itemprop="url" rel="index"><span itemprop="name">嵌入式开发</span></a>
        </span>
          ，
        <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
          <a href="/categories/%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/" itemprop="url" rel="index"><span itemprop="name">02IMX6ULL平台</span></a>
        </span>
          ，
        <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
          <a href="/categories/%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/" itemprop="url" rel="index"><span itemprop="name">LV01-IMX6ULL平台</span></a>
        </span>
    </span>

  
    <span class="post-meta-break"></span>
    <span class="post-meta-item" title="本文字数">
      <span class="post-meta-item-icon">
        <i class="far fa-file-word"></i>
      </span>
      <span class="post-meta-item-text">本文字数：</span>
      <span>16k</span>
    </span>
    <span class="post-meta-item" title="阅读时长">
      <span class="post-meta-item-icon">
        <i class="far fa-clock"></i>
      </span>
      <span class="post-meta-item-text">阅读时长 &asymp;</span>
      <span>59 分钟</span>
    </span>
</div>

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody"><p>本文主要是体验正点原子I.MX6U-ALPHA开发板出厂系统——NXP官方烧写工具mfgtool的相关笔记，若笔记中有错误或者不合适的地方，欢迎批评指正😃。</p>
<span id="more"></span>

<!-- Photo: https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-02-NXP-mfgtool%E7%AE%80%E4%BB%8B/img/ -->

<details class="folding-tag" blue><summary> 点击查看使用工具及版本 </summary>
              <div class='content'>
              <table>    <tr>        <td align="center" rowspan="5">PC端开发环境</td>        <td align="center" width=150px>Windows</td>        <td align="left">Windows11</td>    </tr>    <tr>        <td align="center">Ubuntu</td>        <td align="left">Ubuntu20.04.6的64位版本（一开始使用的是16.04版本，后来进行了升级）</td>      </tr>    <tr>        <td align="center">VMware® Workstation 17 Pro</td>        <td align="left">17.0.0 build-20800274</td>      </tr>    <tr>        <td align="center">终端软件</td>        <td align="left">MobaXterm(Professional Edition v23.0 Build 5042 (license))</td>    </tr>    <tr>        <td align="center">Win32DiskImager</td>        <td align="left">Win32DiskImager v1.0</td>      </tr>    <tr>        <td align="center" rowspan="3">Linux开发板环境</td>        <td align="center">Linux开发板</td>        <td align="left">正点原子 i.MX6ULL Linux 阿尔法开发板</td>      </tr>    <tr>        <td align="center">uboot</td>        <td align="left">NXP官方提供的uboot，NXP提供的版本为uboot-imx-rel_imx_4.1.15_2.1.0_ga(使用的uboot版本为U-Boot 2016.03)</td>      </tr>    <tr>        <td align="center">linux内核</td>        <td align="left">linux-4.15(NXP官方提供)</td>      </tr></table>
              </div>
            </details>

<details class="folding-tag" blue><summary> 点击查看本文参考资料 </summary>
              <div class='content'>
              <table>    <tr>        <td align="center">分类</td>        <td align="center">网址</td>        <td align="center">说明</td>    </tr>    <tr>        <td align="center" rowspan="5">官方网站</td>        <td align="left"><a href="https://www.arm.com/" target="_blank">https://www.arm.com/</a></td>        <td align="left">ARM官方网站，在这里我们可以找到Cotex-Mx以及ARMVx的一些文档</td>    </tr>    <tr>        <td align="left"><a href="https://www.nxp.com.cn/" target="_blank">https://www.nxp.com.cn/ </a></td>        <td align="left">NXP官方网站</td>    </tr>    <tr>        <td align="left"><a href="https://www.nxpic.org.cn/" target="_blank">https://www.nxpic.org.cn/</a></td><td align="left">NXP 官方社区</td>    </tr>    <tr>        <td align="left"><a href="https://u-boot.readthedocs.io/en/latest/" target="_blank">https://u-boot.readthedocs.io/en/latest/</a></td><td align="left">u-boot官网</td>    </tr>    <tr>        <td align="left"><a href="https://www.kernel.org/" target="_blank">https://www.kernel.org/</a></td><td align="left">linux内核官网</td>    </tr></table>
              </div>
            </details>

<details class="folding-tag" blue><summary> 点击查看相关文件下载 </summary>
              <div class='content'>
              <table>    <tr>        <td align="center">分类</td>        <td align="center">网址</td>        <td align="center">说明</td>    </tr>    <tr>        <td align="center" rowspan="4">NXP</td>        <td align="left"><a href="https://github.com/nxp-imx" target="_blank">https://github.com/nxp-imx</a></td>        <td align="left">NXP imx开发资源GitHub组织，里边会有u-boot和linux内核的仓库</td>    </tr>    <tr>        <td align="left"><a href="https://elixir.bootlin.com/linux/latest/source" target="_blank">https://elixir.bootlin.com/linux/latest/source</a></td>        <td align="left">在线阅读linux kernel源码</td>    </tr>    <tr>        <td align="left"><a href="https://github.com/nxp-imx/linux-imx/releases/tag/rel_imx_4.1.15_2.1.0_ga" target="_blank">nxp-imx/linux-imx/releases/tag/rel_imx_4.1.15_2.1.0_ga</a></td>        <td align="left">NXP linux内核仓库tags中的rel_imx_4.1.15_2.1.0_ga</td>    </tr>    <tr>        <td align="left"><a href="https://github.com/nxp-imx/uboot-imx/releases/tag/rel_imx_4.1.15_2.1.0_ga" target="_blank">nxp-imx/uboot-imx/releases/tag/rel_imx_4.1.15_2.1.0_ga</a></td>        <td align="left">NXP u-boot仓库tags中的rel_imx_4.1.15_2.1.0_ga</td>    </tr>    <tr>        <td align="center" rowspan="2">I.MX6ULL</td>        <td align="left"><a href="https://www.nxp.com.cn/docs/en/data-sheet/IMX6ULLIEC.pdf" target="_blank">i.MX 6ULL Applications Processors for Industrial Products</a></td>        <td align="left">I.MX6ULL 芯片手册（datasheet，可以在线查看）</td>    </tr>    <tr>        <td align="left"><a href="https://www.nxp.com.cn/webapp/Download?colCode=IMX6ULLRM&lang_cd=zh" target="_blank">i.MX 6ULL Applications ProcessorReference Manual</a></td>        <td align="left">I.MX6ULL 参考手册（下载后才能查看，需要登录NXP官网）</td>    </tr></table>
              </div>
            </details>

<h1 id="一、mfgtool烧写工具"><a href="#一、mfgtool烧写工具" class="headerlink" title="一、mfgtool烧写工具"></a><font size=3>一、mfgtool烧写工具</font></h1><p>这是一个烧写工具，是NXP专门为自己家的芯片出的一个工具，我们是可以通过脚本来使用这个工具烧写我们所需要的文件到开发板中去，而脚本可以根据我们的需求来写。</p>
<h2 id="1-ALPHA板开发资料中的mfgtool"><a href="#1-ALPHA板开发资料中的mfgtool" class="headerlink" title="1. ALPHA板开发资料中的mfgtool"></a><font size=3>1. ALPHA板开发资料中的mfgtool</font></h2><p>这个烧写工具，在正点原子提供的资料里边已经有了，我们使用的话就先用正点原子提供的这一个：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-02-NXP-mfgtool%E7%AE%80%E4%BB%8B/img/image-20230713074739385.png" alt="image-20230713074739385" style="zoom: 33%;" />

<h2 id="2-NXP官方原版mfgtool"><a href="#2-NXP官方原版mfgtool" class="headerlink" title="2. NXP官方原版mfgtool"></a><font size=3>2. NXP官方原版mfgtool</font></h2><p>我们先对官方原版的mfgtool进行一个了解，方便后边学习定制自己的mfgtool。</p>
<h3 id="2-1-软件下载"><a href="#2-1-软件下载" class="headerlink" title="2.1 软件下载"></a><font size=3>2.1 软件下载</font></h3><p>MfgTool 工具是 NXP 提供的专门用于给 I.MX 系列 CPU 烧写系统的软件，可以在 NXP 官网下载到，由于正点原子出厂的系统都是基于NXP维护的4.1.15的相关BSP资源开发的，所以这里的工具，我也选择相同的版本：<a target="_blank" rel="noopener" href="https://www.nxp.com.cn/webapp/sps/download/license.jsp?colCode=IMX6_L4-1-15_2-0-0_MFG-TOOL&appType=file1&location=null&DOWNLOAD_ID=null">IMX6_L4.1.15_2.0.0_MFG_TOOL (nxp.com.cn)</a>。  下载并解压好的文件如下所示：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-02-NXP-mfgtool%E7%AE%80%E4%BB%8B/img/image-20241103215738343.png" alt="image-20241103215738343" />

<p>解压后有两个.txt 文件和两个.gz 压缩包。 .txt 文档就不去看了，重点是这两个 .gz 压缩包，这两个压缩包的区别在名字上已经写的很详细了。“without-rootfs”和“with-rootfs”，一个是带 rootfs 和一个是不带 rootfs。 </p>
<h3 id="2-2-相关介绍"><a href="#2-2-相关介绍" class="headerlink" title="2.2 相关介绍"></a><font size=3>2.2 相关介绍</font></h3><p>mfg_tools 这个工具本意是给 NXP 自己的开发板设计的烧写软件，所以肯定带有自家开发板对应的 uboot、 linux kernel 和 rootfs 的文件。我们肯定是要烧写文件系统的，所以选择 mfgtools-with-rootfs.tar.gz 这个压缩包，继续对其解压， 解压出一个名为 mfgtools-with-rootfs 的文件夹，此文件夹就包含有我们需要的烧写工具。解压后会包含以下文件：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-02-NXP-mfgtool%E7%AE%80%E4%BB%8B/img/image-20241103215954270.png" alt="image-20241103215954270" />

<p>（1）我们只关心上图中 Profiles 这个文件夹，因为后面要烧写文件就放到这个文件夹中。里面存放着的是其实就是镜像文件，这里面镜像文件分为两种：第一种是作为媒介用途的 镜像，包括uboot、dtb与uImage；第二种是真正烧录到emmc、sdcard或者nand flash的镜像文件。多提一句，之所以存在这两种镜像，是因为MFGTools的烧录 原理是先烧录媒介镜像到ram里面，然后启动，再通过这个启动了的媒介镜像把目标镜像烧录到emmc、sdcard或者nand flash里面。</p>
<p>（2）MfgTool2.exe 就是烧写软件，但是我们不会直接打开这个软件烧写， mfg_tools 不仅能烧写I.MX6U，而且也能给 I.MX7、 I.MX6Q 等芯片烧写，所以在烧写之前必须要进行配置，指定烧写的是什么芯片，烧写到哪里去。</p>
<p>（3）Document文件夹中存放了与该工具相关的文档。</p>
<p>（4）Driver目录为Windows 32位和64位操作系统的驱动，驱动一般都不会出现问题，也就无需理会。</p>
<p>（5）More_scripts目录主要存放一些脚本文件，如果只是单纯使用MFGtool工具 也无需修这些脚本文件，此处暂时无需理会。</p>
<p>（6）还有这些众多的.vbs 文件就是配置脚本，烧写的时候通过双击这些.vbs 文件来打开烧写工具。这些.vbs 烧写脚本既可以根据处理器的不同，由用户自己选择向 I.MX6D、 I.MX6Q、 I.MX6S、 I.MX7、 I.MX6UL 和 I.MX6ULL 等的哪一款芯片烧写系统。也可以根据存储芯片的不同，选择向 EMMC、 NAND 或 QSPI Flash 等的哪一种存储设备烧写，功能非常强大。例如我们现在需要向 I.MX6U 烧写系统 ，那么就需要参考下表所示的 5 个烧写脚本：</p>
<table>
    <tr><td align="center">脚本文件</td><td align="center">描述</td></tr>
    <tr><td align="left">mfgtool2-yocto-mx-evk-emmc.vbs</td><td align="left">EMMC 烧写脚本</td></tr>
    <tr><td align="left">mfgtool2-yocto-mx-evk-nand.vbs</td><td align="left">NAND 烧写脚本</td></tr>
    <tr><td align="left">mfgtool2-yocto-mx-evk-qspi-nor-n25q256a.vbs</td><td align="left">QSPI Flash 烧写脚本，型号为 n25q256a</td></tr>
    <tr><td align="left">mfgtool2-yocto-mx-evk-sdcard-sd1.vbs</td><td align="left" rowspan="2">如果 SD1 和 SD2 接的 SD 卡，这两个文件分 别向 SD1 和 SD2 上的 SD 卡烧写系统。</td></tr>
    <tr><td align="left">mfgtool2-yocto-mx-evk-sdcard-sd2.vbs</td></tr>
</table>
其他的.vbs 烧写脚本用不到，因此可以删除掉。  

<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-02-NXP-mfgtool%E7%AE%80%E4%BB%8B/img/image-20241103221624913.png" alt="image-20241103221624913" />

<h2 id="3-mfgtool启动"><a href="#3-mfgtool启动" class="headerlink" title="3. mfgtool启动"></a><font size=3>3. mfgtool启动</font></h2><p>前边我们做完准备工作后，USB线应该一端接在电脑，另一端接在开发板的USB OTG口，拨码开关应该对应在从USB启动（0100 0000）的状态。</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-02-NXP-mfgtool%E7%AE%80%E4%BB%8B/img/image-20240525164855977.png" alt="image-20240525164855977"  />

<p>当一切准备就绪以后，按一下开发板的复位键，（<strong>如果插了 TF 卡，请弹出 TF 卡，否则电脑不能识别 USB！等识别出来以后再插上 TF 卡！</strong>  ）此时就会进入到 USB 模式，如果是第一次进入 USB 模式的话可能会久一点，这个是免驱的，因此不需要安装驱动。一旦第一次设置好设备以后，后面每次连接都不会有任何提示了。</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-02-NXP-mfgtool%E7%AE%80%E4%BB%8B/img/image-20240525165007553.png" alt="image-20240525165007553" style="zoom:100%;" />

<p>怎么确认连接成功了呢？我们可以双击打开这个文件：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-02-NXP-mfgtool%E7%AE%80%E4%BB%8B/img/image-20221023135227789.png" alt="image-20221023135227789" style="zoom:50%;" />

<p>然后会看到如下弹窗：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-02-NXP-mfgtool%E7%AE%80%E4%BB%8B/img/image-20221023135252376.png" alt="image-20221023135252376" style="zoom:50%;" />

<p>上边显示【No Device Connected】就说明USB连接不成功，我们可以重启开发板重试一下，若识别到USB，连接成功的话，如下图：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-02-NXP-mfgtool%E7%AE%80%E4%BB%8B/img/image-20221023135357169.png" alt="image-20221023135357169" style="zoom:50%;" />

<p>会显示【符合 HID 标准的供应商定义设备】。这里需要注意，我们需要先拔出TF卡，等识别到USB后再插上TF卡即可。</p>
<h1 id="二、系统烧写原理"><a href="#二、系统烧写原理" class="headerlink" title="二、系统烧写原理"></a><font size=3>二、系统烧写原理</font></h1><h2 id="1-烧写流程概述"><a href="#1-烧写流程概述" class="headerlink" title="1. 烧写流程概述"></a><font size=3>1. 烧写流程概述</font></h2><h3 id="1-1-两个阶段"><a href="#1-1-两个阶段" class="headerlink" title="1.1 两个阶段"></a><font size=3>1.1 两个阶段</font></h3><p>开发板连接电脑以后双击“ mfgtool2-yocto-mx-evk-emmc.vbs ”文件打开软件。</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-02-NXP-mfgtool%E7%AE%80%E4%BB%8B/img/image-20221023135529577.png" alt="image-20221023135529577" style="zoom:50%;" />

<p>然后就会打开mfgtool软件，会有如下弹窗：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-02-NXP-mfgtool%E7%AE%80%E4%BB%8B/img/image-20221023135644384.png" alt="image-20221023135644384" style="zoom:50%;" />

<p>【注意】若是使用的是正点原子alpha linux开发板，这里需要先拔掉TF卡，并且将拨码开关拨到从USB启动，否则会识别不到USB。要是有其他的MfgTool2.exe正在运行，这时候就会报Initialize the library failed，error code：29.</p>
<p>如果出现【符合 HID 标准的供应商定义设备】就说明连接正常，可以进行烧写，如果出现其他的字符那么就要检查连接是否正确。点击【Start】按钮即可开始烧写，烧写什么东西呢？肯定是烧写 uboot、 Linux kernel、 .dtb 和 rootfs，那么这四个文件应该放到哪里 MfgTool 才能访问到呢？ 我们进入如下目录中 ：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">L4.1.15_2.0.0-ga_mfg-tools/mfgtools-with-rootfs/mfgtools/Profiles/Linux/OS Firmware</span><br></pre></td></tr></table></figure>

<p>该目录中相关文件如下图所示：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-02-NXP-mfgtool%E7%AE%80%E4%BB%8B/img/image-20221023140005355.png" alt="image-20221023140005355" style="zoom:50%;" />

<p>文件夹“ OS Firmware ”是存放系统固件的，我们重点需要关注该目录中的 files、 firmware 这两个文件夹，以及 ucl2.xml 这个文件。在具体看这三个文件和文件夹之前，我们先来简单了解一下 MfgTool 烧写的工作流程：</p>
<blockquote>
<p>MfgTool 其实是先通过 USB OTG 先将 uboot、 kernel 和.dtb（设备树）这是三个文件下载到开发板的 DDR 中，注意此时不需要下载 rootfs。就相当于<strong>直接在开发板的 DDR上启动 Linux 系统，等 Linux 系统启动以后再向 EMMC 中烧写完整的系统</strong>，包括 uboot、 linux kernel、 .dtb（设备树）和 rootfs，因此 MfgTool 工作过程主要分两个阶段：</p>
<p>（1）将 firmware 目录中的 uboot、 linux kernel 和.dtb（设备树），通过 USB OTG 将这个文件下载到开发板的 DDR 中，目的就是在 DDR 中启动 Linux 系统，为后面的烧写做准备。这个就对应后面的BurnStarp阶段</p>
<p>（2）经过第（1）步的操作，此时 Linux 系统已经运行起来了，系统运行起来以后就可以很方便的完成对 EMMC 的格式化、分区等操作。 EMMC 分区建立好以后就可以从 files 中读取要烧写的 uboot、 linux kernel、 .dtb（设备树）和 rootfs 这 4 个文件，然后将其烧写到 EMMC 中。其实也不仅限于EMMC，这个烧录的位置由用户指定，可以是sd card、nand flash，emmc等。这个对应后面的Updater阶段</p>
</blockquote>
<h3 id="1-2-连接后发生了什么？"><a href="#1-2-连接后发生了什么？" class="headerlink" title="1.2 连接后发生了什么？"></a><font size=3>1.2 连接后发生了什么？</font></h3><img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-02-NXP-mfgtool%E7%AE%80%E4%BB%8B/img/f_fd7ba6ea8122dfb5e44d51f14e840260&t=jpg&o=&s=&v=1584696067.jpeg" alt="img" />

<p>（1）当i.MX6板子上电后，什么都没有初始化，只有Chip ROM（芯片的内部ROM）可以运行。Chip ROM的默认程序会去初始化USB，并将其配置为HID设备。这就是为什么板子设置为Download模式并上电后在PC端的设备管理器可以看到HID-compliant device连上。</p>
<p>（2）一旦PC机检测到HID设备连上，那么PC（USB Host）就会去枚举设备并建立连接。建立连接后的第一件事就是传送一个mini uboot（firmware）到目标板SoC的Chip RAM（芯片的内部RAM）中然后开始运行mini uboot（firmware）。mini uboot会对目标板进行初始化，主要是初始化 DDR&#x2F;外部ROM等设备,所以之后DDR及外部ROM已经可以访问了。mini uboot从mini uboot中提取内存初始化代码或数据来执行任务。也可以使用内存初始化脚本来获取初始化数据。</p>
<p>（3） 初始化外部基本接口之后，PC端会将mini kernel（firmware）、mini system（firmware）、dtb（firmware）传送给SoC并放到DDR(外部RAM)指定的地址。然后PC发送命令，例如ucl2.xml中的：</p>
<figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag">&lt;<span class="name">CMD</span> <span class="attr">state</span>=<span class="string">&quot;BootStrap&quot;</span> <span class="attr">type</span>=<span class="string">&quot;jump&quot;</span> &gt;</span> Jumping to OS image. <span class="tag">&lt;/<span class="name">CMD</span>&gt;</span></span><br></pre></td></tr></table></figure>

<p>PC把这个命令发送给Chip ROM让其跳转到DDR的kernel首地址去执行。</p>
<p>（4）跳转到kernel之后，初始化USB驱动，并枚举为一个MSC设备，此时SoC可以和主机进行高速数据传输。</p>
<p>（5）之后PC机MFGTool工具通过ucl2.xml中的脚本逐条执行剩下的指令直到最后遇到Done指令。</p>
<blockquote>
<p>【说明】</p>
<p>（1）上面提到的mini uboot、mini kernel、mini system、dtb文件均在软件目录下的这个文件夹下：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_">&gt;</span><span class="language-bash">L4.1.15_2.0.0-ga_mfg-tools/mfgtools-with-rootfs/mfgtools/Profiles/Linux/OS Firmware/firmware</span></span><br></pre></td></tr></table></figure>

<p>（2）mini kernel必须要配置USB、USB大容量存储驱动、SD卡、UTP等。详见</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_">&gt;</span><span class="language-bash">L4.1.15_2.0.0-ga_mfg-tools/mfgtools-with-rootfs/mfgtools/Document/V2/Manufacturing Tool V2 Linux or Android Firmware Development Guide V2.docx</span></span><br></pre></td></tr></table></figure>

<p>（3）mini kernel启动linuxrc作为第一个进程，linuxrc其实是一个脚本，最终通过执行 uuc 来启动UTP传输协议。UTP是作为USB Mass Storage(v4 Kernel)驱动的扩展，所以启动 UTP 必须对 USB 进行复位然后重新枚举。</p>
</blockquote>
<h2 id="2-OS-Firmware目录说明"><a href="#2-OS-Firmware目录说明" class="headerlink" title="2. OS Firmware目录说明"></a><font size=3>2. OS Firmware目录说明</font></h2><h3 id="2-1-firmware目录"><a href="#2-1-firmware目录" class="headerlink" title="2.1 firmware目录"></a><font size=3>2.1 firmware目录</font></h3><p>路径为：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">L4.1.15_2.0.0-ga_mfg-tools/mfgtools-with-rootfs/mfgtools/Profiles/Linux/OS Firmware/firmware</span><br></pre></td></tr></table></figure>

<p>打开 firmware 文件夹，里面有很多的 .imx 结尾的 uboot 文件、一个 zImage 镜像文件、很多.dtb结尾的设备树文件。这些文件都是NXP官方开发板使用的，不同的板子使用不同的文件，其中我们需要关心的只有下表的这三个文件：  </p>
<table>
    <tr><td align="center">脚本文件</td><td align="center">描述</td></tr>
    <tr><td align="left">zImage</td><td align="left">NXP 官方 I.MX6ULL EVK 开发板的 Linux 镜像文件。</td></tr>
    <tr><td align="left">u-boot-imx6ull14x14evk_emmc.imx</td><td align="left">NXP 官方 I.MX6ULL EVK 开发板的 uboot 文件。</td></tr>
    <tr><td align="left">zImage-imx6ull-14x14-evk-emmc.dtb</td><td align="left">NXP 官方 I.MX6ULL EVK 开发板的设备树。</td></tr>
</table>
这三个文件就是 I.MX6ULL EVK 开发板烧写系统的时候**第一阶段**所需的文件。**如果要烧写我们的系统，就需要用我们编译出来的zImage、 u-boot.imx 和 imx6ull-alienteke-mmc.dtb 这三个文件替换掉表中这三个文件。**但是名字要和表中的一致，因此需要将 u-boot.imx 重命名为 u-boot-imx6ull14x14evk_emmc.imx，将 imx6ull-alientek-emmc.dtb重命名为 zImage-imx6ull-14x14-evk-emmc.dtb。  

<h3 id="2-2-files目录"><a href="#2-2-files目录" class="headerlink" title="2.2 files目录"></a><font size=3>2.2 files目录</font></h3><p>路径为：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">L4.1.15_2.0.0-ga_mfg-tools/mfgtools-with-rootfs/mfgtools/Profiles/Linux/OS Firmware/files</span><br></pre></td></tr></table></figure>

<p><strong>第二阶段</strong>就是从 files 目录中读取整个系统文件，并将其烧写到 EMMC 中。 files 目录中的文件和firmware 目录中的基本差不多，都是不同板子对应的 uboot、设备树文件，我们只关心下表中的四个文件：</p>
<table>
    <tr><td align="center">脚本文件</td><td align="center">描述</td></tr>
    <tr><td align="left">zImage</td><td align="left">NXP 官方 I.MX6ULL EVK 开发板的 Linux 镜像文件。</td></tr>
    <tr><td align="left">u-boot-imx6ull14x14evk_emmc.imx</td><td align="left">NXP 官方 I.MX6ULL EVK 开发板的 uboot 文件。</td></tr>
    <tr><td align="left">zImage-imx6ull-14x14-evk-emmc.dtb</td><td align="left">NXP 官方 I.MX6ULL EVK 开发板的设备树。</td></tr>
    <tr><td align="left">rootfs_nogpu.tar.bz2</td><td align="left">根文件系统，注意和另外一个 rootfs.tar.bz2 根文件系统区分开。 nogpu 表示此根文件系统不包含 GPU 的内容， I.MX6ULL 没有 GPU，因此要使用此根文件系统。</td></tr>
</table>
如果要烧写我们自己编译出来的系统，就需要用我们编译出来的 zImage、 u-boot.imx 和imx6ull-alientek-emmc.dtb 和 rootfs 这四个文件替换掉上边这四个文件。  

<h3 id="2-3-ucl2-xml-文件"><a href="#2-3-ucl2-xml-文件" class="headerlink" title="2.3 ucl2.xml 文件  "></a><font size=3>2.3 ucl2.xml 文件  </font></h3><h4 id="2-3-1-整体框架"><a href="#2-3-1-整体框架" class="headerlink" title="2.3.1 整体框架"></a><font size=3>2.3.1 整体框架</font></h4><p>files 和 firmware 目录下有众多的 uboot 和设备树，那么烧写的时候究竟选择哪一个呢？这个工作就是由 ucl2.xml 文件来完成的。 </p>
<details class="folding-tag" blue><summary> 点击查看 整体框架 </summary>
              <div class='content'>
              <figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag">&lt;<span class="name">UCL</span>&gt;</span></span><br><span class="line">	<span class="tag">&lt;<span class="name">CFG</span>&gt;</span></span><br><span class="line">		<span class="comment">&lt;!-- 判断向 I.MX 系列的哪个芯片烧写系统 --&gt;</span></span><br><span class="line">        <span class="comment">&lt;!-- 中间部分省略...... --&gt;</span></span><br><span class="line">	<span class="tag">&lt;/<span class="name">CFG</span>&gt;</span></span><br><span class="line">	</span><br><span class="line">	<span class="tag">&lt;<span class="name">LIST</span> <span class="attr">name</span>=<span class="string">&quot;SDCard&quot;</span> <span class="attr">desc</span>=<span class="string">&quot;Choose SD Card as media&quot;</span>&gt;</span></span><br><span class="line">		<span class="comment">&lt;!-- 向 SD 卡烧写 Linux 系统 --&gt;</span></span><br><span class="line">        <span class="comment">&lt;!-- 中间部分省略...... --&gt;</span></span><br><span class="line">	<span class="tag">&lt;/<span class="name">LIST</span>&gt;</span></span><br><span class="line">	</span><br><span class="line">	<span class="tag">&lt;<span class="name">LIST</span> <span class="attr">name</span>=<span class="string">&quot;eMMC&quot;</span> <span class="attr">desc</span>=<span class="string">&quot;Choose eMMC as media&quot;</span>&gt;</span></span><br><span class="line">	<span class="comment">&lt;!-- 向 EMMC 烧写 Linux 系统 --&gt;</span></span><br><span class="line">        <span class="tag">&lt;<span class="name">CMD</span> <span class="attr">state</span>=<span class="string">&quot;BootStrap&quot;</span> <span class="attr">type</span>=<span class="string">&quot;boot&quot;</span> <span class="attr">body</span>=<span class="string">&quot;BootStrap&quot;</span> <span class="attr">file</span> =<span class="string">&quot;firmware/u-boot-imx6ul%6uluboot%_emmc.imx&quot;</span> <span class="attr">ifdev</span>=<span class="string">&quot;MX6UL&quot;</span>&gt;</span>Loading U-boot<span class="tag">&lt;/<span class="name">CMD</span>&gt;</span></span><br><span class="line">		<span class="tag">&lt;<span class="name">CMD</span> <span class="attr">state</span>=<span class="string">&quot;BootStrap&quot;</span> <span class="attr">type</span>=<span class="string">&quot;load&quot;</span> <span class="attr">file</span>=<span class="string">&quot;firmware/zImage&quot;</span> <span class="attr">address</span>=<span class="string">&quot;0x80800000&quot;</span></span></span><br><span class="line"><span class="tag">		<span class="attr">loadSection</span>=<span class="string">&quot;OTH&quot;</span> <span class="attr">setSection</span>=<span class="string">&quot;OTH&quot;</span> <span class="attr">HasFlashHeader</span>=<span class="string">&quot;FALSE&quot;</span> <span class="attr">ifdev</span>=<span class="string">&quot;MX6SL MX6SX MX7D MX6UL MX6ULL&quot;</span>&gt;</span>Loading Kernel.<span class="tag">&lt;/<span class="name">CMD</span>&gt;</span></span><br><span class="line">		<span class="comment">&lt;!-- 中间部分省略...... --&gt;</span></span><br><span class="line">	<span class="tag">&lt;/<span class="name">LIST</span>&gt;</span></span><br><span class="line">	</span><br><span class="line">	<span class="tag">&lt;<span class="name">LIST</span> <span class="attr">name</span>=<span class="string">&quot;Nor Flash&quot;</span> <span class="attr">desc</span>=<span class="string">&quot;Choose Nor flash as media&quot;</span>&gt;</span></span><br><span class="line">		<span class="comment">&lt;!-- 向 Nor Flash 烧写 Linux 系统 --&gt;</span></span><br><span class="line">        <span class="comment">&lt;!-- 中间部分省略...... --&gt;</span></span><br><span class="line">	<span class="tag">&lt;/<span class="name">LIST</span>&gt;</span></span><br><span class="line">	</span><br><span class="line">	<span class="tag">&lt;<span class="name">LIST</span> <span class="attr">name</span>=<span class="string">&quot;Quad Nor Flash&quot;</span> <span class="attr">desc</span>=<span class="string">&quot;Choose Quad Nor flash as media&quot;</span>&gt;</span></span><br><span class="line">		<span class="comment">&lt;!-- 向 Quad Nor Flash 烧写 Linux 系统 --&gt;</span></span><br><span class="line">        <span class="comment">&lt;!-- 中间部分省略...... --&gt;</span></span><br><span class="line">	<span class="tag">&lt;/<span class="name">LIST</span>&gt;</span></span><br><span class="line">	</span><br><span class="line">	<span class="tag">&lt;<span class="name">LIST</span> <span class="attr">name</span>=<span class="string">&quot;NAND Flash&quot;</span> <span class="attr">desc</span>=<span class="string">&quot;Choose NAND as media&quot;</span>&gt;</span></span><br><span class="line">		<span class="comment">&lt;!-- 向 NAND Flash 烧写 Linux 系统 --&gt;</span></span><br><span class="line">        <span class="comment">&lt;!-- 中间部分省略...... --&gt;</span></span><br><span class="line">	<span class="tag">&lt;/<span class="name">LIST</span>&gt;</span></span><br><span class="line">	</span><br><span class="line">	<span class="tag">&lt;<span class="name">LIST</span> <span class="attr">name</span>=<span class="string">&quot;SDCard-Android&quot;</span> <span class="attr">desc</span>=<span class="string">&quot;Choose SD Card as media&quot;</span>&gt;</span></span><br><span class="line">		<span class="comment">&lt;!-- 向 SD 卡烧写 Android 系统 --&gt;</span></span><br><span class="line">        <span class="comment">&lt;!-- 中间部分省略...... --&gt;</span></span><br><span class="line">	<span class="tag">&lt;/<span class="name">LIST</span>&gt;</span></span><br><span class="line">	</span><br><span class="line">	<span class="tag">&lt;<span class="name">LIST</span> <span class="attr">name</span>=<span class="string">&quot;eMMC-Android&quot;</span> <span class="attr">desc</span>=<span class="string">&quot;Choose eMMC as media&quot;</span>&gt;</span></span><br><span class="line">		<span class="comment">&lt;!-- 向 EMMC 烧写 Android 系统 --&gt;</span></span><br><span class="line">        <span class="comment">&lt;!-- 中间部分省略...... --&gt;</span></span><br><span class="line">	<span class="tag">&lt;/<span class="name">LIST</span>&gt;</span></span><br><span class="line">	</span><br><span class="line">	<span class="tag">&lt;<span class="name">LIST</span> <span class="attr">name</span>=<span class="string">&quot;Nand-Android&quot;</span> <span class="attr">desc</span>=<span class="string">&quot;Choose NAND as media&quot;</span>&gt;</span></span><br><span class="line">		<span class="comment">&lt;!-- 向 NAND Flash 烧写 Android 系统 --&gt;</span></span><br><span class="line">        <span class="comment">&lt;!-- 中间部分省略...... --&gt;</span></span><br><span class="line">	<span class="tag">&lt;/<span class="name">LIST</span>&gt;</span></span><br><span class="line">	</span><br><span class="line">	<span class="tag">&lt;<span class="name">LIST</span> <span class="attr">name</span>=<span class="string">&quot;SDCard-Brillo&quot;</span> <span class="attr">desc</span>=<span class="string">&quot;Choose SD Card as media&quot;</span>&gt;</span></span><br><span class="line">		<span class="comment">&lt;!-- 向 SD 卡烧写 Brillo 系统 --&gt;</span></span><br><span class="line">        <span class="comment">&lt;!-- 中间部分省略...... --&gt;</span></span><br><span class="line">	<span class="tag">&lt;/<span class="name">LIST</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">UCL</span>&gt;</span></span><br></pre></td></tr></table></figure>
              </div>
            </details>

<h4 id="2-3-2-UCL标签"><a href="#2-3-2-UCL标签" class="headerlink" title="2.3.2 UCL标签"></a><font size=3>2.3.2 UCL标签</font></h4><p>ucl2.xml 以“&lt;UCL&gt;”开始，以“&lt;&#x2F;UCL&gt;”结束。它表示更新 命令列表（Update Command List，UCL），会被MFGtool工具中的脚本解析，所有的配置都包含在该标签之下。</p>
<h4 id="2-3-3-CFG标签"><a href="#2-3-3-CFG标签" class="headerlink" title="2.3.3 CFG标签"></a><font size=3>2.3.3 CFG标签</font></h4><p>ucl2.xml 首先会判断当前要向 I.MX 系列的哪个芯片烧写系统，相关代码如下：</p>
<figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag">&lt;<span class="name">CFG</span>&gt;</span></span><br><span class="line">  <span class="tag">&lt;<span class="name">STATE</span> <span class="attr">name</span>=<span class="string">&quot;BootStrap&quot;</span> <span class="attr">dev</span>=<span class="string">&quot;MX6SL&quot;</span> <span class="attr">vid</span>=<span class="string">&quot;15A2&quot;</span> <span class="attr">pid</span>=<span class="string">&quot;0063&quot;</span>/&gt;</span></span><br><span class="line">  <span class="tag">&lt;<span class="name">STATE</span> <span class="attr">name</span>=<span class="string">&quot;BootStrap&quot;</span> <span class="attr">dev</span>=<span class="string">&quot;MX6D&quot;</span> <span class="attr">vid</span>=<span class="string">&quot;15A2&quot;</span> <span class="attr">pid</span>=<span class="string">&quot;0061&quot;</span>/&gt;</span></span><br><span class="line">  <span class="tag">&lt;<span class="name">STATE</span> <span class="attr">name</span>=<span class="string">&quot;BootStrap&quot;</span> <span class="attr">dev</span>=<span class="string">&quot;MX6Q&quot;</span> <span class="attr">vid</span>=<span class="string">&quot;15A2&quot;</span> <span class="attr">pid</span>=<span class="string">&quot;0054&quot;</span>/&gt;</span></span><br><span class="line">  <span class="tag">&lt;<span class="name">STATE</span> <span class="attr">name</span>=<span class="string">&quot;BootStrap&quot;</span> <span class="attr">dev</span>=<span class="string">&quot;MX6SX&quot;</span> <span class="attr">vid</span>=<span class="string">&quot;15A2&quot;</span> <span class="attr">pid</span>=<span class="string">&quot;0071&quot;</span>/&gt;</span></span><br><span class="line">  <span class="tag">&lt;<span class="name">STATE</span> <span class="attr">name</span>=<span class="string">&quot;BootStrap&quot;</span> <span class="attr">dev</span>=<span class="string">&quot;MX6UL&quot;</span> <span class="attr">vid</span>=<span class="string">&quot;15A2&quot;</span> <span class="attr">pid</span>=<span class="string">&quot;007D&quot;</span>/&gt;</span></span><br><span class="line">  <span class="tag">&lt;<span class="name">STATE</span> <span class="attr">name</span>=<span class="string">&quot;BootStrap&quot;</span> <span class="attr">dev</span>=<span class="string">&quot;MX7D&quot;</span> <span class="attr">vid</span>=<span class="string">&quot;15A2&quot;</span> <span class="attr">pid</span>=<span class="string">&quot;0076&quot;</span>/&gt;</span></span><br><span class="line">  <span class="tag">&lt;<span class="name">STATE</span> <span class="attr">name</span>=<span class="string">&quot;BootStrap&quot;</span> <span class="attr">dev</span>=<span class="string">&quot;MX6ULL&quot;</span> <span class="attr">vid</span>=<span class="string">&quot;15A2&quot;</span> <span class="attr">pid</span>=<span class="string">&quot;0080&quot;</span>/&gt;</span></span><br><span class="line">  <span class="tag">&lt;<span class="name">STATE</span> <span class="attr">name</span>=<span class="string">&quot;Updater&quot;</span>   <span class="attr">dev</span>=<span class="string">&quot;MSC&quot;</span> <span class="attr">vid</span>=<span class="string">&quot;066F&quot;</span> <span class="attr">pid</span>=<span class="string">&quot;37FF&quot;</span>/&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">CFG</span>&gt;</span></span><br></pre></td></tr></table></figure>

<p>这个标签之间是配置相关内容，通过读取芯片的 VID 和 PID 即可判断出当前要烧写什么处理器的系统，如果VID&#x3D;0X15A2，PID&#x3D;0080，那么就表示要给 I.MX6ULL 烧写系统。</p>
<p>它是MFGtool工具的一些全局配置，如在第一阶段（BootStrap）设备枚举，dev的值可以 为MX6SL、MX6D、MX6Q、MX6SX、MX6UL、MX6ULL、MX7D其中的一个或 多个（因为MFGtool工具可以同时烧录多个开发板），如果USB 的vid为15A2，pid为0080，那么MFGtool工具会将dev识别为MX6ULL，这USB中 的vid与pid是由芯片本身决定的，当dev为MX6ULL时，在后续的烧录任务中会通过ifdev MX6ULL进行选择执行哪些语句，然后将name设置为BootStrap，标识当前处于第 一阶段，不同的阶段执行的处理是不一样的。这个阶段简单来说就是将开发板的USB OTG接口 连接电脑，并且被MFGtool工具识别，才能有接下来的烧录操作。</p>
<p>如果USB中的vid为066F，pid为37FF，则表示进入第二阶段，将dev标识为MSG，而name则被设置为Updater。</p>
<p>简单来说，烧录分为两个阶段，BurnStarp和Updater，通过全局配置设备的vid和pid，来选择操作的设备（开发板）。</p>
<h4 id="2-3-4-LIST标签"><a href="#2-3-4-LIST标签" class="headerlink" title="2.3.4 LIST标签"></a><font size=3>2.3.4 LIST标签</font></h4><figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag">&lt;<span class="name">LIST</span> <span class="attr">name</span>=<span class="string">&quot;eMMC&quot;</span> <span class="attr">desc</span>=<span class="string">&quot;Choose eMMC as media&quot;</span>&gt;</span></span><br><span class="line">	<span class="comment">&lt;!-- 向 EMMC 烧写 Linux 系统 --&gt;</span></span><br><span class="line">        <span class="tag">&lt;<span class="name">CMD</span> <span class="attr">state</span>=<span class="string">&quot;BootStrap&quot;</span> <span class="attr">type</span>=<span class="string">&quot;boot&quot;</span> <span class="attr">body</span>=<span class="string">&quot;BootStrap&quot;</span> <span class="attr">file</span> =<span class="string">&quot;firmware/u-boot-imx6ul%6uluboot%_emmc.imx&quot;</span> <span class="attr">ifdev</span>=<span class="string">&quot;MX6UL&quot;</span>&gt;</span>Loading U-boot<span class="tag">&lt;/<span class="name">CMD</span>&gt;</span></span><br><span class="line">		<span class="tag">&lt;<span class="name">CMD</span> <span class="attr">state</span>=<span class="string">&quot;BootStrap&quot;</span> <span class="attr">type</span>=<span class="string">&quot;load&quot;</span> <span class="attr">file</span>=<span class="string">&quot;firmware/zImage&quot;</span> <span class="attr">address</span>=<span class="string">&quot;0x80800000&quot;</span></span></span><br><span class="line"><span class="tag">		<span class="attr">loadSection</span>=<span class="string">&quot;OTH&quot;</span> <span class="attr">setSection</span>=<span class="string">&quot;OTH&quot;</span> <span class="attr">HasFlashHeader</span>=<span class="string">&quot;FALSE&quot;</span> <span class="attr">ifdev</span>=<span class="string">&quot;MX6SL MX6SX MX7D MX6UL MX6ULL&quot;</span>&gt;</span>Loading Kernel.<span class="tag">&lt;/<span class="name">CMD</span>&gt;</span></span><br><span class="line">		<span class="comment">&lt;!-- 中间部分省略...... --&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">LIST</span>&gt;</span></span><br></pre></td></tr></table></figure>

<p>“&lt;LIST&gt;”和“&lt;&#x2F;LIST&gt;”之间的是针对不同存储芯片的烧写命令。 这就是前面说的 列表配置，list后面有name、desc等参数，name则表示选择cfg.ini文件中 的list内容中的配置，可以为SDCard、eMMC、NAND Flash等。而desc参数用来说明目的，选择烧录 的位置，如Choose SD Cardas media、Choose eMMC as media、Choose NAND as media等。</p>
<h4 id="2-3-5-CMD标签"><a href="#2-3-5-CMD标签" class="headerlink" title="2.3.5 CMD标签"></a><font size=3>2.3.5 CMD标签</font></h4><figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag">&lt;<span class="name">CMD</span> <span class="attr">state</span>=<span class="string">&quot;BootStrap&quot;</span> <span class="attr">type</span>=<span class="string">&quot;boot&quot;</span> <span class="attr">body</span>=<span class="string">&quot;BootStrap&quot;</span> <span class="attr">file</span> =<span class="string">&quot;firmware/u-boot-imx6ul%6uluboot%_emmc.imx&quot;</span> <span class="attr">ifdev</span>=<span class="string">&quot;MX6UL&quot;</span>&gt;</span>Loading U-boot<span class="tag">&lt;/<span class="name">CMD</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">CMD</span> <span class="attr">state</span>=<span class="string">&quot;BootStrap&quot;</span> <span class="attr">type</span>=<span class="string">&quot;load&quot;</span> <span class="attr">file</span>=<span class="string">&quot;firmware/zImage&quot;</span> <span class="attr">address</span>=<span class="string">&quot;0x80800000&quot;</span> <span class="attr">loadSection</span>=<span class="string">&quot;OTH&quot;</span> <span class="attr">setSection</span>=<span class="string">&quot;OTH&quot;</span> <span class="attr">HasFlashHeader</span>=<span class="string">&quot;FALSE&quot;</span> <span class="attr">ifdev</span>=<span class="string">&quot;MX6SL MX6SX MX7D MX6UL MX6ULL&quot;</span>&gt;</span>Loading Kernel.<span class="tag">&lt;/<span class="name">CMD</span>&gt;</span></span><br></pre></td></tr></table></figure>

<p>在&lt; LIST &gt; &lt;&#x2F;LIST&gt;标签下有多个&lt;CMD&gt; &lt;&#x2F;CMD&gt;标签，这是命令标签，在不同的 阶段命令是不一样的，MFGtool工具的命令分为主机特定命令（Host Specific Commands）与固件特定命令（Firmware Specific Commands），其中主机特定命令是由MFGtool工具解析和执行，而固件特定命令由 目标设备上的固件运行解析和执行。</p>
<p>命令标签下有多个属性，如state用于表示该命令在哪个阶段被执行，type表示执行命令的类型，body表示命令的参数，flie则是其他参数，如需要烧录哪个文件，最后 的Loading Kernel、Loading U-boot则是命令描述。</p>
<h5 id="2-3-5-1-两种命令"><a href="#2-3-5-1-两种命令" class="headerlink" title="2.3.5.1 两种命令"></a><font size=3>2.3.5.1 两种命令</font></h5><ul>
<li>主机特定命令（Host Specific Commands）的命令类型有多种，其他参数也有多种，具体见下表（空余处表示无参数）。</li>
</ul>
<table class="docutils align-default">
    <colgroup>
        <col style="width: 12%">
        <col style="width: 12%">
        <col style="width: 10%">
        <col style="width: 66%">
    </colgroup>
    <thead>
        <tr class="row-odd">
            <th>
                <p>命令类型</p>
            </th>
            <th>
                <p>命令参数</p>
            </th>
            <th>
                <p>其他参数</p>
            </th>
            <th>
                <p>说明</p>
            </th>
        </tr>
    </thead>
    <tbody>
        <tr class="row-even">
            <td>
                <p>load</p>
            </td>
            <td></td>
            <td>
                <p>file</p>
            </td>
            <td>
                <p>烧录的镜像文件的路径和文件名</p>
            </td>
        </tr>
        <tr class="row-odd">
            <td>
                <p></p>
            </td>
            <td></td>
            <td>
                <p>Address</p>
            </td>
            <td>
                <p>镜像存放的RAM地址</p>
            </td>
        </tr>
        <tr class="row-even">
            <td>
                <p></p>
            </td>
            <td></td>
            <td>
                <p>loadSection</p>
            </td>
            <td>
                <p>ROM代码使用的参数，应设置为“OTH”</p>
            </td>
        </tr>
        <tr class="row-odd">
            <td>
                <p></p>
            </td>
            <td></td>
            <td>
                <p>setSection</p>
            </td>
            <td>
                <p>设置为OTH，如果还有其他镜像，设置为APP</p>
            </td>
        </tr>
        <tr class="row-even">
            <td>
                <p></p>
            </td>
            <td></td>
            <td>
                <p>HasFlashHeader</p>
            </td>
            <td>
                <p>镜像如果包含flash header，设为TRUE，否则设置为FALSE</p>
            </td>
        </tr>
        <tr class="row-odd">
            <td>
                <p></p>
            </td>
            <td></td>
            <td>
                <p>CodeOffset</p>
            </td>
            <td>
                <p>第一次执行的指令的地址偏移量。注意：该命令仅适用于除i.MX50 HID模式设备之外的Bulk-IO模式i.MX设备。</p>
            </td>
        </tr>
        <tr class="row-even">
            <td>
                <p>jump</p>
            </td>
            <td></td>
            <td></td>
            <td>
                <p>通知ROM代码跳转到RAM映像运行</p>
            </td>
        </tr>
        <tr class="row-odd">
            <td>
                <p>boot</p>
            </td>
            <td>
                <p>保留</p>
            </td>
            <td>
                <p>flie</p>
            </td>
            <td>
                <p>加载映像到RAM</p>
            </td>
        </tr>
        <tr class="row-even">
            <td>
                <p></p>
            </td>
            <td></td>
            <td>
                <p>if</p>
            </td>
            <td>
                <p>执行判断</p>
            </td>
        </tr>
    </tbody>
</table>

<ul>
<li>固件特定命令（Firmware Specific Commands）的命令类型有多种，其他参数也有多种：</li>
</ul>
<table class="docutils align-default">
    <colgroup>
        <col style="width: 9%">
        <col style="width: 8%">
        <col style="width: 83%">
    </colgroup>
    <thead>
        <tr class="row-odd">
            <th class="head">
                <p>命令</p>
            </th>
            <th class="head">
                <p>参数</p>
            </th>
            <th class="head">
                <p>说明</p>
            </th>
        </tr>
    </thead>
    <tbody>
        <tr class="row-even">
            <td>
                <p>?</p>
            </td>
            <td></td>
            <td>
                <p>请求以XML格式发送设备标识信息</p>
            </td>
        </tr>
        <tr class="row-odd">
            <td>
                <p>!</p>
            </td>
            <td>
                <p>integer</p>
            </td>
            <td>
                <p>根据参数进行重启操作</p>
            </td>
        </tr>
        <tr class="row-even">
            <td>
                <p>$</p>
            </td>
            <td>
                <p>string</p>
            </td>
            <td>
                <p>执行shell命令，这是最常用的命令类型</p>
            </td>
        </tr>
        <tr class="row-odd">
            <td>
                <p>flush</p>
            </td>
            <td></td>
            <td>
                <p>等待所有数据传输完成并处理</p>
            </td>
        </tr>
        <tr class="row-even">
            <td>
                <p>ffs</p>
            </td>
            <td></td>
            <td>
                <p>对SD卡进行分区并将引导流闪存到它</p>
            </td>
        </tr>
        <tr class="row-odd">
            <td>
                <p>read</p>
            </td>
            <td>
                <p>string</p>
            </td>
            <td>
                <p>读取参数指定的文件并将其发送给主机。如果没有这样的文件，将返回相应的状态</p>
            </td>
        </tr>
        <tr class="row-even">
            <td>
                <p>send</p>
            </td>
            <td></td>
            <td>
                <p>从主机接收文件</p>
            </td>
        </tr>
        <tr class="row-odd">
            <td>
                <p>selftest</p>
            </td>
            <td></td>
            <td>
                <p>进行自我诊断， 返回通过或适当状态。在当前版本中未实现</p>
            </td>
        </tr>
        <tr class="row-even">
            <td>
                <p>save</p>
            </td>
            <td>
                <p>string</p>
            </td>
            <td>
                <p>将命令“send”接收的文件保存到指定为参数的文件中。</p>
            </td>
        </tr>
        <tr class="row-odd">
            <td>
                <p>pipe</p>
            </td>
            <td>
                <p>string</p>
            </td>
            <td>
                <p>执行shell命令并从管道的输入端读取数据。 MFGtool工具会将文件发送到管道输出端</p>
            </td>
        </tr>
        <tr class="row-even">
            <td>
                <p>wff</p>
            </td>
            <td></td>
            <td>
                <p>准备将固件写入flash</p>
            </td>
        </tr>
        <tr class="row-odd">
            <td>
                <p>wfs</p>
            </td>
            <td></td>
            <td>
                <p>准备将固件写入SD Card</p>
            </td>
        </tr>
        <tr class="row-even">
            <td>
                <p>ffs</p>
            </td>
            <td></td>
            <td>
                <p>将固件写入SD Card</p>
            </td>
        </tr>
    </tbody>
</table>

<p>如果命令被命名为”push”即type&#x3D;”push”，这意味着 命令由目标设备而不是主机解析和执行，主机唯一要做的就是将命令发送到目标设备，通过body进行发 送命令。（固件特定命令已删减，且空余处表示无参数）。如果命令被命名为”push”即type&#x3D;”push”，这意味着命令由目标设备而不是主机解析和执行，主机唯一要做的就是将命令发送到目标设备，通过body进行发送命令。</p>
<h5 id="2-3-5-2-文件匹配"><a href="#2-3-5-2-文件匹配" class="headerlink" title="2.3.5.2 文件匹配"></a><font size=3>2.3.5.2 文件匹配</font></h5><p>看上面这条命令：</p>
<figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag">&lt;<span class="name">CMD</span> <span class="attr">state</span>=<span class="string">&quot;BootStrap&quot;</span> <span class="attr">type</span>=<span class="string">&quot;boot&quot;</span> <span class="attr">body</span>=<span class="string">&quot;BootStrap&quot;</span> <span class="attr">file</span> =<span class="string">&quot;firmware/u-boot-imx6ul%6uluboot%_emmc.imx&quot;</span> <span class="attr">ifdev</span>=<span class="string">&quot;MX6UL&quot;</span>&gt;</span>Loading U-boot<span class="tag">&lt;/<span class="name">CMD</span>&gt;</span></span><br></pre></td></tr></table></figure>

<p>这个文件里的%都是啥？这里其实要用到后面的cfg.ini或者xxx.vbs文件，我们后面再说。</p>
<h2 id="3-xxx-vbs文件"><a href="#3-xxx-vbs文件" class="headerlink" title="3. xxx.vbs文件"></a><font size=3>3. xxx.vbs文件</font></h2><p>上边确定了处理器以后就要确定向什么存储设备烧写系统，这个时候就要用到 mfgtool2-yocto-mx-evk-emmc.vbs 脚本文件了，此文件内容如下：  </p>
<figure class="highlight vbscript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">Set</span> wshShell = <span class="built_in">CreateObject</span>(<span class="string">&quot;WScript.shell&quot;</span>)</span><br><span class="line">wshShell.run <span class="string">&quot;mfgtool2.exe -c &quot;&quot;linux&quot;&quot; -l &quot;&quot;eMMC&quot;&quot; -s &quot;&quot;board=sabresd&quot;&quot; -s &quot;&quot;mmc=1&quot;&quot; -s &quot;&quot;6uluboot=14x14evk&quot;&quot; -s &quot;&quot;6uldtb=14x14-evk&quot;&quot;&quot;</span></span><br><span class="line"><span class="keyword">Set</span> wshShell = <span class="literal">Nothing</span></span><br></pre></td></tr></table></figure>

<p>第 2 行：就是 “ wshShell.run ” 这一行，这里一行调用了 mfgtool2.exe 这个软件，并且还给出了一系列的参数，其中就有 “ eMMC ” 字样，说明是向 EMMC 烧写系统，要烧写的存储设备就这样确定下来了。“ wshShell.run ”后面还有一堆的其他参数，这些参数都有对应的值，如下所示：  </p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">board=sabresd</span><br><span class="line">mmc=1</span><br><span class="line">6uluboot=14x14evk</span><br><span class="line">6uldtb=14x14-evk</span><br></pre></td></tr></table></figure>

<p>是不是很眼熟，还记得上面的哪条命令吧：</p>
<figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag">&lt;<span class="name">CMD</span> <span class="attr">state</span>=<span class="string">&quot;BootStrap&quot;</span> <span class="attr">type</span>=<span class="string">&quot;boot&quot;</span> <span class="attr">body</span>=<span class="string">&quot;BootStrap&quot;</span> <span class="attr">file</span> =<span class="string">&quot;firmware/u-boot-imx6ul%6uluboot%_emmc.imx&quot;</span> <span class="attr">ifdev</span>=<span class="string">&quot;MX6UL&quot;</span>&gt;</span>Loading U-boot<span class="tag">&lt;/<span class="name">CMD</span>&gt;</span></span><br></pre></td></tr></table></figure>

<p>就像这条命令的6uluboot，会被14x14evk取代，所以这里的文件就是<code>firmware/u-boot-imx6ul14x14evk_emmc.imx</code>，即：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-02-NXP-mfgtool%E7%AE%80%E4%BB%8B/img/image-20241104223009081.png" alt="image-20241104223009081" />

<p>也就是说这些参数最终将会被 ucl2.xml 文件所使用，最终用于确定各个文件名。另外这个-l参数，据我猜测是决定LIST标签中的name，这里的name是eMMC,就会对应：</p>
<figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag">&lt;<span class="name">LIST</span> <span class="attr">name</span>=<span class="string">&quot;eMMC&quot;</span> <span class="attr">desc</span>=<span class="string">&quot;Choose eMMC as media&quot;</span>&gt;</span></span><br><span class="line"><span class="comment">&lt;!-- 中间部分省略...... --&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">LIST</span>&gt;</span></span><br></pre></td></tr></table></figure>

<h2 id="4-UICfg-ini文件"><a href="#4-UICfg-ini文件" class="headerlink" title="4. UICfg.ini文件"></a><font size=3>4. UICfg.ini文件</font></h2><figure class="highlight ini"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="section">[UICfg]</span></span><br><span class="line"><span class="attr">PortMgrDlg</span>=<span class="number">1</span></span><br></pre></td></tr></table></figure>

<p>UICfg.ini文件是用来配置同时烧录多少个开发板，即配置其多通道的烧录。我们此处并不量产，默认配置为1。</p>
<h2 id="5-cfg-ini文件"><a href="#5-cfg-ini文件" class="headerlink" title="5. cfg.ini文件"></a><font size=3>5. cfg.ini文件</font></h2><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">L4.1.15_2.0.0-ga_mfg-tools/mfgtools-with-rootfs/mfgtools/cfg.ini</span><br></pre></td></tr></table></figure>

<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-02-NXP-mfgtool%E7%AE%80%E4%BB%8B/img/image-20241104074701149.png" alt="image-20241104074701149" />

<p>cfg.ini文件主要是用来配置目标芯片类型和板子信息及存储器的方式等内容的，其主要文件内容 包括四部分内容，分别是profiles、platform、list、variable。需要注意的是，这个文件实际是给ucl2.xml文件使用的，用于确认里面%…%之间的值，相当于一个默认的配置文件，<strong>它里面的值会被xxx.vbs文件中的命令所取代</strong>。</p>
<ul>
<li>profiles</li>
</ul>
<figure class="highlight ini"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="section">[profiles]</span></span><br><span class="line"><span class="attr">chip</span> = Linux</span><br></pre></td></tr></table></figure>

<p>表示要使用Profiles目录下哪个文件夹的内容进行烧录。如以上配置使用“&#x2F;profiles&#x2F;Linux&#x2F;OS Firmware&#x2F;ucl2.xml”目录 下的ucl2.xml配置烧录。会被<code>mfgtool2.exe -c &quot;&quot;xxx&quot;&quot;</code>覆盖。</p>
<ul>
<li>platform</li>
</ul>
<figure class="highlight ini"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="section">[platform]</span></span><br><span class="line"><span class="attr">board</span> = SabreSD</span><br></pre></td></tr></table></figure>

<p>开发板名字，目前没有作用，可以忽略</p>
<ul>
<li>list</li>
</ul>
<figure class="highlight ini"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="section">[LIST]</span></span><br><span class="line"><span class="attr">name</span> = SDCard</span><br></pre></td></tr></table></figure>

<p>表示使用“&#x2F;profiles&#x2F;CHIP_PROFILE&#x2F;OS Firmware&#x2F;ucl2.xml”文件中 的哪个list配置进行烧录，如将name 设置为 SDCard，则使用 ucl2.xml文 件中 SDCard一栏的配置进行烧录。会被<code>mfgtool2.exe -l &quot;&quot;xxx&quot;&quot;</code>覆盖。</p>
<figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag">&lt;<span class="name">LIST</span> <span class="attr">name</span>=<span class="string">&quot;SDCard&quot;</span> <span class="attr">desc</span>=<span class="string">&quot;Choose SD Card as media&quot;</span>&gt;</span></span><br><span class="line">    <span class="comment">&lt;!-- 向 SD 卡烧写 Linux 系统 --&gt;</span></span><br><span class="line">    <span class="comment">&lt;!-- 中间部分省略...... --&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">LIST</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">LIST</span> <span class="attr">name</span>=<span class="string">&quot;eMMC&quot;</span> <span class="attr">desc</span>=<span class="string">&quot;Choose eMMC as media&quot;</span>&gt;</span></span><br><span class="line">	<span class="comment">&lt;!-- 向 EMMC 烧写 Linux 系统 --&gt;</span></span><br><span class="line">	<span class="comment">&lt;!-- 中间部分省略...... --&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">LIST</span>&gt;</span></span><br></pre></td></tr></table></figure>

<ul>
<li>variable</li>
</ul>
<p>variable中是一些环境变量，在list列表配置中会引用的环境 变量，会被会被<code>mfgtool2.exe -s &quot;&quot;xxx=variable&quot;&quot;</code>覆盖。</p>
<figure class="highlight ini"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br></pre></td><td class="code"><pre><span class="line"><span class="section">[variable]</span></span><br><span class="line"><span class="attr">board</span> = sabresd</span><br><span class="line"><span class="attr">mmc</span> = <span class="number">0</span></span><br><span class="line"><span class="attr">sxuboot</span>=sabresd</span><br><span class="line"><span class="attr">sxdtb</span>=sdb</span><br><span class="line"><span class="attr">7duboot</span>=sabresd</span><br><span class="line"><span class="attr">7ddtb</span>=sdb</span><br><span class="line"><span class="attr">6uluboot</span>=<span class="number">14</span>x14ddr3arm2</span><br><span class="line"><span class="attr">6uldtb</span>=<span class="number">14</span>x14-ddr3-arm2</span><br><span class="line"><span class="attr">6ulldtb</span>=<span class="number">14</span>x14-ddr3-arm2</span><br><span class="line"><span class="attr">ldo</span>=</span><br><span class="line"><span class="attr">plus</span>=</span><br><span class="line"><span class="attr">lite</span>=l</span><br><span class="line"><span class="attr">initramfs</span>=fsl-image-mfgtool-initramfs-imx_mfgtools.cpio.gz.u-boot</span><br><span class="line"><span class="attr">seek</span> = <span class="number">1</span></span><br><span class="line"><span class="attr">sxnor</span>=qspi2</span><br><span class="line"><span class="attr">7dnor</span>=qspi1</span><br><span class="line"><span class="attr">6ulnor</span>=qspi1</span><br><span class="line"><span class="attr">nor_part</span>=<span class="number">0</span></span><br></pre></td></tr></table></figure>

<p>例如</p>
<figure class="highlight ini"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">initramfs</span>=fsl-image-mfgtool-initramfs-imx_mfgtools.cpio.gz.u-boot</span><br></pre></td></tr></table></figure>

<p>在”&#x2F;profiles&#x2F;CHIP_PROFILE&#x2F;OS Firmware&#x2F;ucl2.xml”文件中会被引用</p>
<figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag">&lt;<span class="name">CMD</span> <span class="attr">state</span>=<span class="string">&quot;BootStrap&quot;</span> <span class="attr">type</span>=<span class="string">&quot;load&quot;</span> <span class="attr">file</span>=<span class="string">&quot;firmware/%initramfs%&quot;</span> <span class="attr">address</span>=<span class="string">&quot;0x83800000&quot;</span></span></span><br><span class="line"><span class="tag">		<span class="attr">loadSection</span>=<span class="string">&quot;OTH&quot;</span> <span class="attr">setSection</span>=<span class="string">&quot;OTH&quot;</span> <span class="attr">HasFlashHeader</span>=<span class="string">&quot;FALSE&quot;</span> <span class="attr">ifdev</span>=<span class="string">&quot;MX6SL MX6SX MX7D MX6UL MX6ULL&quot;</span>&gt;</span>Loading Initramfs.<span class="tag">&lt;/<span class="name">CMD</span>&gt;</span></span><br></pre></td></tr></table></figure>

<p>其引用的方式为”%…%”，在两 个百分号（%）之间，通过变量initramfs进行传递。</p>
<h2 id="6-烧写过程分析"><a href="#6-烧写过程分析" class="headerlink" title="6. 烧写过程分析"></a><font size=3>6. 烧写过程分析</font></h2><p>我们接下来实例分析一下点击这个mfgtool2-yocto-mx-evk-emmc.vbs之后会发生什么。</p>
<h3 id="6-1-参数配置"><a href="#6-1-参数配置" class="headerlink" title="6.1 参数配置"></a><font size=3>6.1 参数配置</font></h3><p>我们看一下这个mfgtool2-yocto-mx-evk-emmc.vbs脚本：</p>
<figure class="highlight vb"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">Set</span> wshShell = CreateObject(<span class="string">&quot;WScript.shell&quot;</span>)</span><br><span class="line">wshShell.run <span class="string">&quot;mfgtool2.exe -c &quot;&quot;linux&quot;&quot; -l &quot;&quot;eMMC&quot;&quot; -s &quot;&quot;board=sabresd&quot;&quot; -s &quot;&quot;mmc=1&quot;&quot; -s &quot;&quot;6uluboot=14x14evk&quot;&quot; -s &quot;&quot;6uldtb=14x14-evk&quot;&quot;&quot;</span></span><br><span class="line"><span class="keyword">Set</span> wshShell = <span class="literal">Nothing</span></span><br></pre></td></tr></table></figure>

<p>可以得到这些配置项：</p>
<figure class="highlight ini"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">board</span>=sabresd</span><br><span class="line"><span class="attr">mmc</span>=<span class="number">1</span></span><br><span class="line"><span class="attr">6uluboot</span>=<span class="number">14</span>x14evk</span><br><span class="line"><span class="attr">6uldtb</span>=<span class="number">14</span>x14-evk</span><br><span class="line"></span><br><span class="line"><span class="attr">name</span>=eMMC</span><br></pre></td></tr></table></figure>

<p>我们结合一下cfg.ini，我们会得到传入ucl2.xml 文件的各个参数的值：</p>
<figure class="highlight ini"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br></pre></td><td class="code"><pre><span class="line"><span class="section">[profiles]</span></span><br><span class="line"><span class="attr">chip</span> = Linux</span><br><span class="line"></span><br><span class="line"><span class="section">[platform]</span></span><br><span class="line"><span class="attr">board</span> = SabreSD</span><br><span class="line"></span><br><span class="line"><span class="section">[LIST]</span></span><br><span class="line"><span class="attr">name</span> = eMMC</span><br><span class="line"></span><br><span class="line"><span class="section">[variable]</span></span><br><span class="line"><span class="attr">board</span> = sabresd</span><br><span class="line"><span class="attr">mmc</span> = <span class="number">1</span></span><br><span class="line"><span class="attr">sxuboot</span>=sabresd</span><br><span class="line"><span class="attr">sxdtb</span>=sdb</span><br><span class="line"><span class="attr">7duboot</span>=sabresd</span><br><span class="line"><span class="attr">7ddtb</span>=sdb</span><br><span class="line"><span class="attr">6uluboot</span>=<span class="number">14</span>x14evk</span><br><span class="line"><span class="attr">6uldtb</span>=<span class="number">14</span>x14-evk</span><br><span class="line"><span class="attr">6ulldtb</span>=<span class="number">14</span>x14-ddr3-arm2</span><br><span class="line"><span class="attr">ldo</span>=</span><br><span class="line"><span class="attr">plus</span>=</span><br><span class="line"><span class="attr">lite</span>=l</span><br><span class="line"><span class="attr">initramfs</span>=fsl-image-mfgtool-initramfs-imx_mfgtools.cpio.gz.u-boot</span><br><span class="line"><span class="attr">seek</span> = <span class="number">1</span></span><br><span class="line"><span class="attr">sxnor</span>=qspi2</span><br><span class="line"><span class="attr">7dnor</span>=qspi1</span><br><span class="line"><span class="attr">6ulnor</span>=qspi1</span><br><span class="line"><span class="attr">nor_part</span>=<span class="number">0</span></span><br></pre></td></tr></table></figure>

<h3 id="6-2-CFG"><a href="#6-2-CFG" class="headerlink" title="6.2 CFG"></a><font size=3>6.2 CFG</font></h3><p>首先进入CFG标签，开始选择器件，这例正点原子alpha开发板使用的是imx6ull，所以这里dev肯定是”MX6ULL”。</p>
<figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag">&lt;<span class="name">CFG</span>&gt;</span></span><br><span class="line">  <span class="comment">&lt;!-- 其他的省略 --&gt;</span></span><br><span class="line">  <span class="tag">&lt;<span class="name">STATE</span> <span class="attr">name</span>=<span class="string">&quot;BootStrap&quot;</span> <span class="attr">dev</span>=<span class="string">&quot;MX6ULL&quot;</span> <span class="attr">vid</span>=<span class="string">&quot;15A2&quot;</span> <span class="attr">pid</span>=<span class="string">&quot;0080&quot;</span>/&gt;</span></span><br><span class="line">  <span class="tag">&lt;<span class="name">STATE</span> <span class="attr">name</span>=<span class="string">&quot;Updater&quot;</span>   <span class="attr">dev</span>=<span class="string">&quot;MSC&quot;</span> <span class="attr">vid</span>=<span class="string">&quot;066F&quot;</span> <span class="attr">pid</span>=<span class="string">&quot;37FF&quot;</span>/&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">CFG</span>&gt;</span></span><br></pre></td></tr></table></figure>

<h3 id="6-3-LIST"><a href="#6-3-LIST" class="headerlink" title="6.3 LIST"></a><font size=3>6.3 LIST</font></h3><p>前面根据最终配置参数，我们的name&#x3D;eMMC，所以会选到这个LIST：</p>
<figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag">&lt;<span class="name">LIST</span> <span class="attr">name</span>=<span class="string">&quot;eMMC&quot;</span> <span class="attr">desc</span>=<span class="string">&quot;Choose eMMC as media&quot;</span>&gt;</span></span><br><span class="line">    <span class="comment">&lt;!-- 其他的省略 --&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">LIST</span>&gt;</span></span><br></pre></td></tr></table></figure>

<p>后面我们只需要关注这个标签里的命令即可。</p>
<h3 id="6-4-CMD——BootStrap"><a href="#6-4-CMD——BootStrap" class="headerlink" title="6.4 CMD——BootStrap"></a><font size=3>6.4 CMD——BootStrap</font></h3><h4 id="6-4-1-BootStrap——uboot"><a href="#6-4-1-BootStrap——uboot" class="headerlink" title="6.4.1 BootStrap——uboot"></a><font size=3>6.4.1 BootStrap——uboot</font></h4><figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag">&lt;<span class="name">CMD</span> <span class="attr">state</span>=<span class="string">&quot;BootStrap&quot;</span> <span class="attr">type</span>=<span class="string">&quot;boot&quot;</span> <span class="attr">body</span>=<span class="string">&quot;BootStrap&quot;</span> <span class="attr">file</span> =<span class="string">&quot;firmware/u-boot-imx6q%plus%%board%_sd.imx&quot;</span> <span class="attr">ifdev</span>=<span class="string">&quot;MX6Q&quot;</span>&gt;</span>Loading U-boot<span class="tag">&lt;/<span class="name">CMD</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">CMD</span> <span class="attr">state</span>=<span class="string">&quot;BootStrap&quot;</span> <span class="attr">type</span>=<span class="string">&quot;boot&quot;</span> <span class="attr">body</span>=<span class="string">&quot;BootStrap&quot;</span> <span class="attr">file</span> =<span class="string">&quot;firmware/u-boot-imx6dl%board%_sd.imx&quot;</span> <span class="attr">ifdev</span>=<span class="string">&quot;MX6D&quot;</span>&gt;</span>Loading U-boot<span class="tag">&lt;/<span class="name">CMD</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">CMD</span> <span class="attr">state</span>=<span class="string">&quot;BootStrap&quot;</span> <span class="attr">type</span>=<span class="string">&quot;boot&quot;</span> <span class="attr">body</span>=<span class="string">&quot;BootStrap&quot;</span> <span class="attr">file</span> =<span class="string">&quot;firmware/u-boot-imx6sx%board%_emmc.imx&quot;</span> <span class="attr">ifdev</span>=<span class="string">&quot;MX6SX&quot;</span>&gt;</span>Loading U-boot<span class="tag">&lt;/<span class="name">CMD</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">CMD</span> <span class="attr">state</span>=<span class="string">&quot;BootStrap&quot;</span> <span class="attr">type</span>=<span class="string">&quot;boot&quot;</span> <span class="attr">body</span>=<span class="string">&quot;BootStrap&quot;</span> <span class="attr">file</span> =<span class="string">&quot;firmware/u-boot-imx7d%7duboot%_sd.imx&quot;</span> <span class="attr">ifdev</span>=<span class="string">&quot;MX7D&quot;</span>&gt;</span>Loading U-boot<span class="tag">&lt;/<span class="name">CMD</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">CMD</span> <span class="attr">state</span>=<span class="string">&quot;BootStrap&quot;</span> <span class="attr">type</span>=<span class="string">&quot;boot&quot;</span> <span class="attr">body</span>=<span class="string">&quot;BootStrap&quot;</span> <span class="attr">file</span> =<span class="string">&quot;firmware/u-boot-imx6ul%6uluboot%_emmc.imx&quot;</span> <span class="attr">ifdev</span>=<span class="string">&quot;MX6UL&quot;</span>&gt;</span>Loading U-boot<span class="tag">&lt;/<span class="name">CMD</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">CMD</span> <span class="attr">state</span>=<span class="string">&quot;BootStrap&quot;</span> <span class="attr">type</span>=<span class="string">&quot;boot&quot;</span> <span class="attr">body</span>=<span class="string">&quot;BootStrap&quot;</span> <span class="attr">file</span> =<span class="string">&quot;firmware/u-boot-imx6ul%lite%%6uluboot%_emmc.imx&quot;</span> <span class="attr">ifdev</span>=<span class="string">&quot;MX6ULL&quot;</span>&gt;</span>Loading U-boot<span class="tag">&lt;/<span class="name">CMD</span>&gt;</span></span><br><span class="line">		</span><br></pre></td></tr></table></figure>

<p>前面我们知道dev是等于MX6ULL，所以这里只需要关注：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">&lt;CMD state=&quot;BootStrap&quot; type=&quot;boot&quot; body=&quot;BootStrap&quot; file =&quot;firmware/u-boot-imx6ul%lite%%6uluboot%_emmc.imx&quot; ifdev=&quot;MX6ULL&quot;&gt;Loading U-boot&lt;/CMD&gt;</span><br></pre></td></tr></table></figure>

<p>%lite%根据前面的配置文件为l，%6uluboot%为14x14evk，所以这里展开就是：</p>
<figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag">&lt;<span class="name">CMD</span> <span class="attr">state</span>=<span class="string">&quot;BootStrap&quot;</span> <span class="attr">type</span>=<span class="string">&quot;boot&quot;</span> <span class="attr">body</span>=<span class="string">&quot;BootStrap&quot;</span> <span class="attr">file</span> =<span class="string">&quot;firmware/u-boot-imx6ull14x14evk_emmc.imx&quot;</span> <span class="attr">ifdev</span>=<span class="string">&quot;MX6ULL&quot;</span>&gt;</span>Loading U-boot<span class="tag">&lt;/<span class="name">CMD</span>&gt;</span></span><br></pre></td></tr></table></figure>

<p>这个时候就使用的是这个文件：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-02-NXP-mfgtool%E7%AE%80%E4%BB%8B/img/image-20241104232733823.png" alt="image-20241104232733823" />

<p>这个时候，mfgtool就会将这个imx文件下载到DRAM中。</p>
<h4 id="6-4-2-BootStarp——kernel"><a href="#6-4-2-BootStarp——kernel" class="headerlink" title="6.4.2 BootStarp——kernel"></a><font size=3>6.4.2 BootStarp——kernel</font></h4><p>接下来是内核：</p>
<figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag">&lt;<span class="name">CMD</span> <span class="attr">state</span>=<span class="string">&quot;BootStrap&quot;</span> <span class="attr">type</span>=<span class="string">&quot;load&quot;</span> <span class="attr">file</span>=<span class="string">&quot;firmware/zImage&quot;</span> <span class="attr">address</span>=<span class="string">&quot;0x12000000&quot;</span> <span class="attr">loadSection</span>=<span class="string">&quot;OTH&quot;</span> <span class="attr">setSection</span>=<span class="string">&quot;OTH&quot;</span> <span class="attr">HasFlashHeader</span>=<span class="string">&quot;FALSE&quot;</span> <span class="attr">ifdev</span>=<span class="string">&quot;MX6Q MX6D&quot;</span>&gt;</span>Loading Kernel.<span class="tag">&lt;/<span class="name">CMD</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">CMD</span> <span class="attr">state</span>=<span class="string">&quot;BootStrap&quot;</span> <span class="attr">type</span>=<span class="string">&quot;load&quot;</span> <span class="attr">file</span>=<span class="string">&quot;firmware/zImage&quot;</span> <span class="attr">address</span>=<span class="string">&quot;0x80800000&quot;</span> <span class="attr">loadSection</span>=<span class="string">&quot;OTH&quot;</span> <span class="attr">setSection</span>=<span class="string">&quot;OTH&quot;</span> <span class="attr">HasFlashHeader</span>=<span class="string">&quot;FALSE&quot;</span> <span class="attr">ifdev</span>=<span class="string">&quot;MX6SL MX6SX MX7D MX6UL MX6ULL&quot;</span>&gt;</span>Loading Kernel.<span class="tag">&lt;/<span class="name">CMD</span>&gt;</span></span><br></pre></td></tr></table></figure>

<p>不管哪一款芯片，内核镜像的名字都是zimage,只是下载的位置不同，我们这里是MX6ULl，所以是这个：</p>
<figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag">&lt;<span class="name">CMD</span> <span class="attr">state</span>=<span class="string">&quot;BootStrap&quot;</span> <span class="attr">type</span>=<span class="string">&quot;load&quot;</span> <span class="attr">file</span>=<span class="string">&quot;firmware/zImage&quot;</span> <span class="attr">address</span>=<span class="string">&quot;0x80800000&quot;</span> <span class="attr">loadSection</span>=<span class="string">&quot;OTH&quot;</span> <span class="attr">setSection</span>=<span class="string">&quot;OTH&quot;</span> <span class="attr">HasFlashHeader</span>=<span class="string">&quot;FALSE&quot;</span> <span class="attr">ifdev</span>=<span class="string">&quot;MX6SL MX6SX MX7D MX6UL MX6ULL&quot;</span>&gt;</span>Loading Kernel.<span class="tag">&lt;/<span class="name">CMD</span>&gt;</span></span><br></pre></td></tr></table></figure>

<p>使用的就是这个文件：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-02-NXP-mfgtool%E7%AE%80%E4%BB%8B/img/image-20241104234003124.png" alt="image-20241104234003124" />

<h4 id="6-4-3-BootStrap——Initramfs"><a href="#6-4-3-BootStrap——Initramfs" class="headerlink" title="6.4.3 BootStrap——Initramfs"></a><font size=3>6.4.3 BootStrap——Initramfs</font></h4><figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag">&lt;<span class="name">CMD</span> <span class="attr">state</span>=<span class="string">&quot;BootStrap&quot;</span> <span class="attr">type</span>=<span class="string">&quot;load&quot;</span> <span class="attr">file</span>=<span class="string">&quot;firmware/%initramfs%&quot;</span> <span class="attr">address</span>=<span class="string">&quot;0x12C00000&quot;</span></span></span><br><span class="line"><span class="tag">	<span class="attr">loadSection</span>=<span class="string">&quot;OTH&quot;</span> <span class="attr">setSection</span>=<span class="string">&quot;OTH&quot;</span> <span class="attr">HasFlashHeader</span>=<span class="string">&quot;FALSE&quot;</span> <span class="attr">ifdev</span>=<span class="string">&quot;MX6Q MX6D&quot;</span>&gt;</span>Loading Initramfs.<span class="tag">&lt;/<span class="name">CMD</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">CMD</span> <span class="attr">state</span>=<span class="string">&quot;BootStrap&quot;</span> <span class="attr">type</span>=<span class="string">&quot;load&quot;</span> <span class="attr">file</span>=<span class="string">&quot;firmware/%initramfs%&quot;</span> <span class="attr">address</span>=<span class="string">&quot;0x83800000&quot;</span></span></span><br><span class="line"><span class="tag">	<span class="attr">loadSection</span>=<span class="string">&quot;OTH&quot;</span> <span class="attr">setSection</span>=<span class="string">&quot;OTH&quot;</span> <span class="attr">HasFlashHeader</span>=<span class="string">&quot;FALSE&quot;</span> <span class="attr">ifdev</span>=<span class="string">&quot;MX6SL MX6SX MX7D MX6UL MX6ULL&quot;</span>&gt;</span>Loading Initramfs.<span class="tag">&lt;/<span class="name">CMD</span>&gt;</span></span><br></pre></td></tr></table></figure>

<p>这个文件嘛，我也不知道是干啥的，好像是可以删掉，我在正点原子的mfgtool中没看到这个命令，但是这里也分析一下吧。根据前面的配置文件，这里的%initramfs%是：</p>
<figure class="highlight ini"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">initramfs</span>=fsl-image-mfgtool-initramfs-imx_mfgtools.cpio.gz.u-boot</span><br></pre></td></tr></table></figure>

<p>所以这里展开就是：</p>
<figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag">&lt;<span class="name">CMD</span> <span class="attr">state</span>=<span class="string">&quot;BootStrap&quot;</span> <span class="attr">type</span>=<span class="string">&quot;load&quot;</span> <span class="attr">file</span>=<span class="string">&quot;firmware/fsl-image-mfgtool-initramfs-imx_mfgtools.cpio.gz.u-boot&quot;</span> <span class="attr">address</span>=<span class="string">&quot;0x83800000&quot;</span> <span class="attr">loadSection</span>=<span class="string">&quot;OTH&quot;</span> <span class="attr">setSection</span>=<span class="string">&quot;OTH&quot;</span> <span class="attr">HasFlashHeader</span>=<span class="string">&quot;FALSE&quot;</span> <span class="attr">ifdev</span>=<span class="string">&quot;MX6SL MX6SX MX7D MX6UL MX6ULL&quot;</span>&gt;</span>Loading Initramfs.<span class="tag">&lt;/<span class="name">CMD</span>&gt;</span></span><br></pre></td></tr></table></figure>

<p>就是这个文件：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-02-NXP-mfgtool%E7%AE%80%E4%BB%8B/img/image-20241104234352843.png" alt="image-20241104234352843" />

<h4 id="6-4-4-BootStrap——device-tree"><a href="#6-4-4-BootStrap——device-tree" class="headerlink" title="6.4.4 BootStrap——device tree"></a><font size=3>6.4.4 BootStrap——device tree</font></h4><p>然后就是设备树啦，我们来看一下 ：</p>
<figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag">&lt;<span class="name">CMD</span> <span class="attr">state</span>=<span class="string">&quot;BootStrap&quot;</span> <span class="attr">type</span>=<span class="string">&quot;load&quot;</span> <span class="attr">file</span>=<span class="string">&quot;firmware/zImage-imx6q%plus%-%board%%ldo%.dtb&quot;</span> <span class="attr">address</span>=<span class="string">&quot;0x18000000&quot;</span></span></span><br><span class="line"><span class="tag">	<span class="attr">loadSection</span>=<span class="string">&quot;OTH&quot;</span> <span class="attr">setSection</span>=<span class="string">&quot;OTH&quot;</span> <span class="attr">HasFlashHeader</span>=<span class="string">&quot;FALSE&quot;</span> <span class="attr">ifdev</span>=<span class="string">&quot;MX6Q&quot;</span>&gt;</span>Loading device tree.<span class="tag">&lt;/<span class="name">CMD</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">CMD</span> <span class="attr">state</span>=<span class="string">&quot;BootStrap&quot;</span> <span class="attr">type</span>=<span class="string">&quot;load&quot;</span> <span class="attr">file</span>=<span class="string">&quot;firmware/zImage-imx6dl-%board%%ldo%.dtb&quot;</span> <span class="attr">address</span>=<span class="string">&quot;0x18000000&quot;</span></span></span><br><span class="line"><span class="tag">	<span class="attr">loadSection</span>=<span class="string">&quot;OTH&quot;</span> <span class="attr">setSection</span>=<span class="string">&quot;OTH&quot;</span> <span class="attr">HasFlashHeader</span>=<span class="string">&quot;FALSE&quot;</span> <span class="attr">ifdev</span>=<span class="string">&quot;MX6D&quot;</span>&gt;</span>Loading device tree.<span class="tag">&lt;/<span class="name">CMD</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">CMD</span> <span class="attr">state</span>=<span class="string">&quot;BootStrap&quot;</span> <span class="attr">type</span>=<span class="string">&quot;load&quot;</span> <span class="attr">file</span>=<span class="string">&quot;firmware/zImage-imx6sx-%sxdtb%-emmc.dtb&quot;</span> <span class="attr">address</span>=<span class="string">&quot;0x83000000&quot;</span></span></span><br><span class="line"><span class="tag">	<span class="attr">loadSection</span>=<span class="string">&quot;OTH&quot;</span> <span class="attr">setSection</span>=<span class="string">&quot;OTH&quot;</span> <span class="attr">HasFlashHeader</span>=<span class="string">&quot;FALSE&quot;</span> <span class="attr">ifdev</span>=<span class="string">&quot;MX6SX&quot;</span>&gt;</span>Loading device tree.<span class="tag">&lt;/<span class="name">CMD</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">CMD</span> <span class="attr">state</span>=<span class="string">&quot;BootStrap&quot;</span> <span class="attr">type</span>=<span class="string">&quot;load&quot;</span> <span class="attr">file</span>=<span class="string">&quot;firmware/zImage-imx7d-%7ddtb%.dtb&quot;</span> <span class="attr">address</span>=<span class="string">&quot;0x83000000&quot;</span></span></span><br><span class="line"><span class="tag">	<span class="attr">loadSection</span>=<span class="string">&quot;OTH&quot;</span> <span class="attr">setSection</span>=<span class="string">&quot;OTH&quot;</span> <span class="attr">HasFlashHeader</span>=<span class="string">&quot;FALSE&quot;</span> <span class="attr">ifdev</span>=<span class="string">&quot;MX7D&quot;</span>&gt;</span>Loading device tree.<span class="tag">&lt;/<span class="name">CMD</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">CMD</span> <span class="attr">state</span>=<span class="string">&quot;BootStrap&quot;</span> <span class="attr">type</span>=<span class="string">&quot;load&quot;</span> <span class="attr">file</span>=<span class="string">&quot;firmware/zImage-imx6ul-%6uldtb%-emmc.dtb&quot;</span> <span class="attr">address</span>=<span class="string">&quot;0x83000000&quot;</span></span></span><br><span class="line"><span class="tag">	<span class="attr">loadSection</span>=<span class="string">&quot;OTH&quot;</span> <span class="attr">setSection</span>=<span class="string">&quot;OTH&quot;</span> <span class="attr">HasFlashHeader</span>=<span class="string">&quot;FALSE&quot;</span> <span class="attr">ifdev</span>=<span class="string">&quot;MX6UL&quot;</span>&gt;</span>Loading device tree.<span class="tag">&lt;/<span class="name">CMD</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">CMD</span> <span class="attr">state</span>=<span class="string">&quot;BootStrap&quot;</span> <span class="attr">type</span>=<span class="string">&quot;load&quot;</span> <span class="attr">file</span>=<span class="string">&quot;firmware/zImage-imx6ul%lite%-%6uldtb%-emmc.dtb&quot;</span> <span class="attr">address</span>=<span class="string">&quot;0x83000000&quot;</span></span></span><br><span class="line"><span class="tag">	<span class="attr">loadSection</span>=<span class="string">&quot;OTH&quot;</span> <span class="attr">setSection</span>=<span class="string">&quot;OTH&quot;</span> <span class="attr">HasFlashHeader</span>=<span class="string">&quot;FALSE&quot;</span> <span class="attr">ifdev</span>=<span class="string">&quot;MX6ULL&quot;</span>&gt;</span>Loading device tree.<span class="tag">&lt;/<span class="name">CMD</span>&gt;</span></span><br></pre></td></tr></table></figure>

<p>我们直接看这个MX6ULL：</p>
<figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag">&lt;<span class="name">CMD</span> <span class="attr">state</span>=<span class="string">&quot;BootStrap&quot;</span> <span class="attr">type</span>=<span class="string">&quot;load&quot;</span> <span class="attr">file</span>=<span class="string">&quot;firmware/zImage-imx6ul%lite%-%6uldtb%-emmc.dtb&quot;</span> <span class="attr">address</span>=<span class="string">&quot;0x83000000&quot;</span> <span class="attr">loadSection</span>=<span class="string">&quot;OTH&quot;</span> <span class="attr">setSection</span>=<span class="string">&quot;OTH&quot;</span> <span class="attr">HasFlashHeader</span>=<span class="string">&quot;FALSE&quot;</span> <span class="attr">ifdev</span>=<span class="string">&quot;MX6ULL&quot;</span>&gt;</span>Loading device tree.<span class="tag">&lt;/<span class="name">CMD</span>&gt;</span></span><br></pre></td></tr></table></figure>

<p>根据前面的配置文件，我们得到%lite%&#x3D;l，%6uldtb%&#x3D;14x14-evk，所以这里命令展开就是：</p>
<figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag">&lt;<span class="name">CMD</span> <span class="attr">state</span>=<span class="string">&quot;BootStrap&quot;</span> <span class="attr">type</span>=<span class="string">&quot;load&quot;</span> <span class="attr">file</span>=<span class="string">&quot;firmware/zImage-imx6ull-14x14-evk-emmc.dtb&quot;</span> <span class="attr">address</span>=<span class="string">&quot;0x83000000&quot;</span> <span class="attr">loadSection</span>=<span class="string">&quot;OTH&quot;</span> <span class="attr">setSection</span>=<span class="string">&quot;OTH&quot;</span> <span class="attr">HasFlashHeader</span>=<span class="string">&quot;FALSE&quot;</span> <span class="attr">ifdev</span>=<span class="string">&quot;MX6ULL&quot;</span>&gt;</span>Loading device tree.<span class="tag">&lt;/<span class="name">CMD</span>&gt;</span></span><br></pre></td></tr></table></figure>

<p>就是这个文件：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-02-NXP-mfgtool%E7%AE%80%E4%BB%8B/img/image-20241104234816747.png" alt="image-20241104234816747" />

<h4 id="6-4-5-BootStrap——jump"><a href="#6-4-5-BootStrap——jump" class="headerlink" title="6.4.5 BootStrap——jump"></a><font size=3>6.4.5 BootStrap——jump</font></h4><p>这里就来到了第一阶段的结尾，则是Jumping to OS image，应该就是去启动这个已经下载到DRAM的Linux系统，从而进入到系统烧写的第二个阶段，在看第二阶段的代码前，先总结一下第一阶段烧写了哪些固件，基于i.mx6ul这款SoC，下载到DRAM的固件如下：</p>
<table>
    <tbody>
        <tr>
            <td style="text-align: center">固件</td>
            <td style="text-align: center">下载文件</td>
        </tr>
        <tr>
            <td style="text-align: center">uboot</td>
            <td>firmware/u-boot-imx6ull14x14evk_emmc.imx</td>
        </tr>
        <tr>
            <td style="text-align: center">kernel</td>
            <td>firmware/zImage</td>
        </tr>
        <tr>
            <td style="text-align: center">initramfs</td>
            <td>firmware/fsl-image-mfgtool-initramfs-imx_mfgtools.cpio.gz.u-boot</td>
        </tr>
        <tr>
            <td style="text-align: center">dtb</td>
            <td>firmware/zImage-imx6ull-14x14-evk-emmc.dtb</td>
        </tr>
    </tbody>
</table>

<p>这里结束，我们其实已经在开发板上运行起来了一个linux系统，后续第二阶段就是通过这个linux系统将相关的uboot、kernel、dtb、rootfs等烧写到eMMC中去。</p>
<h3 id="6-5-CMD——Updater"><a href="#6-5-CMD——Updater" class="headerlink" title="6.5 CMD——Updater"></a><font size=3>6.5 CMD——Updater</font></h3><h4 id="6-5-1-Updater——create-partition"><a href="#6-5-1-Updater——create-partition" class="headerlink" title="6.5.1 Updater——create partition"></a><font size=3>6.5.1 Updater——create partition</font></h4><p>一开始先创建分区：</p>
<figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag">&lt;<span class="name">CMD</span> <span class="attr">state</span>=<span class="string">&quot;Updater&quot;</span> <span class="attr">type</span>=<span class="string">&quot;push&quot;</span> <span class="attr">body</span>=<span class="string">&quot;send&quot;</span> <span class="attr">file</span>=<span class="string">&quot;mksdcard.sh.tar&quot;</span>&gt;</span>Sending partition shell<span class="tag">&lt;/<span class="name">CMD</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">CMD</span> <span class="attr">state</span>=<span class="string">&quot;Updater&quot;</span> <span class="attr">type</span>=<span class="string">&quot;push&quot;</span> <span class="attr">body</span>=<span class="string">&quot;$ tar xf $FILE &quot;</span>&gt;</span> Partitioning...<span class="tag">&lt;/<span class="name">CMD</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">CMD</span> <span class="attr">state</span>=<span class="string">&quot;Updater&quot;</span> <span class="attr">type</span>=<span class="string">&quot;push&quot;</span> <span class="attr">body</span>=<span class="string">&quot;$ sh mksdcard.sh /dev/mmcblk%mmc%&quot;</span>&gt;</span> Partitioning...<span class="tag">&lt;/<span class="name">CMD</span>&gt;</span></span><br></pre></td></tr></table></figure>

<p>我们看一下这个mksdcard.sh.tar文件里面是什么：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-02-NXP-mfgtool%E7%AE%80%E4%BB%8B/img/image-20241105000348103.png" alt="image-20241105000348103" />

<p>我们打开这个脚本看一眼：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_">#</span><span class="language-bash">!/bin/sh</span></span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">partition size <span class="keyword">in</span> MB</span></span><br><span class="line">BOOT_ROM_SIZE=10</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"><span class="built_in">wait</span> <span class="keyword">for</span> the SD/MMC device node ready</span></span><br><span class="line">while [ ! -e $1 ]</span><br><span class="line">do</span><br><span class="line">sleep 1</span><br><span class="line">echo “wait for $1 appear”</span><br><span class="line">done</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">call sfdisk to create partition table</span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">destroy the partition table</span></span><br><span class="line">node=$1</span><br><span class="line">dd if=/dev/zero of=$&#123;node&#125; bs=1024 count=1</span><br><span class="line"></span><br><span class="line">sfdisk --force $&#123;node&#125; &lt;&lt; EOF</span><br><span class="line"><span class="meta prompt_">$</span><span class="language-bash">&#123;BOOT_ROM_SIZE&#125;M,500M,0c</span></span><br><span class="line">600M,,83</span><br><span class="line">EOF</span><br></pre></td></tr></table></figure>

<p>我们再来看一下%mmc%，根据前面的配置，这个值应该是1，所以最后一个命令就是：</p>
<figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag">&lt;<span class="name">CMD</span> <span class="attr">state</span>=<span class="string">&quot;Updater&quot;</span> <span class="attr">type</span>=<span class="string">&quot;push&quot;</span> <span class="attr">body</span>=<span class="string">&quot;$ sh mksdcard.sh /dev/mmcblk1&quot;</span>&gt;</span> Partitioning...<span class="tag">&lt;/<span class="name">CMD</span>&gt;</span></span><br></pre></td></tr></table></figure>

<p>可以看到是通过mksdcard.sh使用sfdisk工具对&#x2F;dev&#x2F;mmcblk1进行分区。脚本的命令解析一下就是：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line">node=/dev/mmcblk1</span><br><span class="line">BOOT_ROM_SIZE=10</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">所以有</span></span><br><span class="line">dd if=/dev/zero of=/dev/mmcblk1 bs=1024 count=1</span><br><span class="line"></span><br><span class="line">sfdisk --force /dev/mmcblk1 &lt;&lt; EOF</span><br><span class="line">10M,500M,0c</span><br><span class="line">600M,,83</span><br><span class="line">EOF</span><br></pre></td></tr></table></figure>

<h4 id="6-5-2-Updater——burn-uboot"><a href="#6-5-2-Updater——burn-uboot" class="headerlink" title="6.5.2 Updater——burn uboot"></a><font size=3>6.5.2 Updater——burn uboot</font></h4><p>我们来看一下这几条CMD.</p>
<ul>
<li>clear u-boot arg</li>
</ul>
<figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">&lt;!-- burn uboot --&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">CMD</span> <span class="attr">state</span>=<span class="string">&quot;Updater&quot;</span> <span class="attr">type</span>=<span class="string">&quot;push&quot;</span> <span class="attr">body</span>=<span class="string">&quot;$ dd if=/dev/zero of=/dev/mmcblk%mmc% bs=1k seek=768 conv=fsync count=8&quot;</span>&gt;</span>clear u-boot arg<span class="tag">&lt;/<span class="name">CMD</span>&gt;</span></span><br></pre></td></tr></table></figure>

<p>首先是清空要烧写uboot的区域，我们前面知道%mmc%&#x3D;1，所以这里就是：</p>
<figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag">&lt;<span class="name">CMD</span> <span class="attr">state</span>=<span class="string">&quot;Updater&quot;</span> <span class="attr">type</span>=<span class="string">&quot;push&quot;</span> <span class="attr">body</span>=<span class="string">&quot;$ dd if=/dev/zero of=/dev/mmcblk1 bs=1k seek=768 conv=fsync count=8&quot;</span>&gt;</span>clear u-boot arg<span class="tag">&lt;/<span class="name">CMD</span>&gt;</span></span><br></pre></td></tr></table></figure>

<ul>
<li>access boot partition and send</li>
</ul>
<figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag">&lt;<span class="name">CMD</span> <span class="attr">state</span>=<span class="string">&quot;Updater&quot;</span> <span class="attr">type</span>=<span class="string">&quot;push&quot;</span> <span class="attr">body</span>=<span class="string">&quot;$ echo 0 &gt; /sys/block/mmcblk%mmc%boot0/force_ro&quot;</span>&gt;</span>access boot partition 1<span class="tag">&lt;/<span class="name">CMD</span>&gt;</span></span><br><span class="line"><span class="comment">&lt;!-- 中间省略 --&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">CMD</span> <span class="attr">state</span>=<span class="string">&quot;Updater&quot;</span> <span class="attr">type</span>=<span class="string">&quot;push&quot;</span> <span class="attr">body</span>=<span class="string">&quot;send&quot;</span> <span class="attr">file</span>=<span class="string">&quot;files/u-boot-imx6ul%lite%%6uluboot%_emmc.imx&quot;</span> <span class="attr">ifdev</span>=<span class="string">&quot;MX6ULL&quot;</span>&gt;</span>Sending u-boot.bin<span class="tag">&lt;/<span class="name">CMD</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">CMD</span> <span class="attr">state</span>=<span class="string">&quot;Updater&quot;</span> <span class="attr">type</span>=<span class="string">&quot;push&quot;</span> <span class="attr">body</span>=<span class="string">&quot;$ dd if=$FILE of=/dev/mmcblk%mmc%boot0 bs=512 seek=2&quot;</span>&gt;</span>write U-Boot to sd card<span class="tag">&lt;/<span class="name">CMD</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">CMD</span> <span class="attr">state</span>=<span class="string">&quot;Updater&quot;</span> <span class="attr">type</span>=<span class="string">&quot;push&quot;</span> <span class="attr">body</span>=<span class="string">&quot;$ echo 1 &gt; /sys/block/mmcblk%mmc%boot0/force_ro&quot;</span>&gt;</span> re-enable read-only access <span class="tag">&lt;/<span class="name">CMD</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">CMD</span> <span class="attr">state</span>=<span class="string">&quot;Updater&quot;</span> <span class="attr">type</span>=<span class="string">&quot;push&quot;</span> <span class="attr">body</span>=<span class="string">&quot;$ mmc bootpart enable 1 1 /dev/mmcblk%mmc%&quot;</span>&gt;</span>enable boot partion 1 to boot<span class="tag">&lt;/<span class="name">CMD</span>&gt;</span></span><br></pre></td></tr></table></figure>

<p>这里这几个变量是：</p>
<figure class="highlight ini"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">%mmc%=1</span><br><span class="line">%lite%=l</span><br><span class="line">%6uluboot%=14x14evk</span><br></pre></td></tr></table></figure>

<p>变量的值替换后就是：</p>
<figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag">&lt;<span class="name">CMD</span> <span class="attr">state</span>=<span class="string">&quot;Updater&quot;</span> <span class="attr">type</span>=<span class="string">&quot;push&quot;</span> <span class="attr">body</span>=<span class="string">&quot;$ echo 0 &gt; /sys/block/mmcblk1boot0/force_ro&quot;</span>&gt;</span>access boot partition 1<span class="tag">&lt;/<span class="name">CMD</span>&gt;</span></span><br><span class="line"><span class="comment">&lt;!-- 中间省略 --&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">CMD</span> <span class="attr">state</span>=<span class="string">&quot;Updater&quot;</span> <span class="attr">type</span>=<span class="string">&quot;push&quot;</span> <span class="attr">body</span>=<span class="string">&quot;send&quot;</span> <span class="attr">file</span>=<span class="string">&quot;files/u-boot-imx6ull14x14evk_emmc.imx&quot;</span> <span class="attr">ifdev</span>=<span class="string">&quot;MX6ULL&quot;</span>&gt;</span>Sending u-boot.bin<span class="tag">&lt;/<span class="name">CMD</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">CMD</span> <span class="attr">state</span>=<span class="string">&quot;Updater&quot;</span> <span class="attr">type</span>=<span class="string">&quot;push&quot;</span> <span class="attr">body</span>=<span class="string">&quot;$ dd if=$FILE of=/dev/mmcblk1boot0 bs=512 seek=2&quot;</span>&gt;</span>write U-Boot to sd card<span class="tag">&lt;/<span class="name">CMD</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">CMD</span> <span class="attr">state</span>=<span class="string">&quot;Updater&quot;</span> <span class="attr">type</span>=<span class="string">&quot;push&quot;</span> <span class="attr">body</span>=<span class="string">&quot;$ echo 1 &gt; /sys/block/mmcblk1boot0/force_ro&quot;</span>&gt;</span> re-enable read-only access <span class="tag">&lt;/<span class="name">CMD</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">CMD</span> <span class="attr">state</span>=<span class="string">&quot;Updater&quot;</span> <span class="attr">type</span>=<span class="string">&quot;push&quot;</span> <span class="attr">body</span>=<span class="string">&quot;$ mmc bootpart enable 1 1 /dev/mmcblk1&quot;</span>&gt;</span>enable boot partion 1 to boot<span class="tag">&lt;/<span class="name">CMD</span>&gt;</span></span><br></pre></td></tr></table></figure>

<p>这里的过程是先发送，再写入，发送的时候是这个目录的文件：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-02-NXP-mfgtool%E7%AE%80%E4%BB%8B/img/image-20241105065317996.png" alt="image-20241105065317996" />

<p>这里要先了解一些eMMC的分区，在eMMC器件里有两种存储器，SRAM（静态随机访问存储器）和NAND闪存。SRAM是位于控制器ASIC里面为了数据暂时保存以及被控制器微处理器快速访问的易失性存储器。NAND阵列是由一个或者多个晶片组成的非易失性存储器，大概的框图如下：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-02-NXP-mfgtool%E7%AE%80%E4%BB%8B/img/v2-6160f8710a2afd2e8c8ee267b8427c78_1440w.jpeg" alt="eMMC深入浅出 第二章 eMMC结构 第二节 分区以及存储区域" style="zoom:50%;" />

<p>mmcblk1boot0其实就代表eMMC的<strong>Boot Area Partitions</strong>（Boot Area包含两个Boot Area Partitions），一般是拿来存储Bootloader，支持SOC从eMMC启动系统。详细的就不再说了，以后学习的时候再详细了解。</p>
<h4 id="6-5-3-Updater——create-fat-partition"><a href="#6-5-3-Updater——create-fat-partition" class="headerlink" title="6.5.3 Updater——create fat partition"></a><font size=3>6.5.3 Updater——create fat partition</font></h4><p>创建一个fat分区:</p>
<figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag">&lt;<span class="name">CMD</span> <span class="attr">state</span>=<span class="string">&quot;Updater&quot;</span> <span class="attr">type</span>=<span class="string">&quot;push&quot;</span> <span class="attr">body</span>=<span class="string">&quot;$ while [ ! -e /dev/mmcblk%mmc%p1 ]; do sleep 1; echo \&quot;</span><span class="attr">waiting...</span>\&quot;; <span class="attr">done</span> &quot;&gt;</span>Waiting for the partition ready<span class="tag">&lt;/<span class="name">CMD</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">CMD</span> <span class="attr">state</span>=<span class="string">&quot;Updater&quot;</span> <span class="attr">type</span>=<span class="string">&quot;push&quot;</span> <span class="attr">body</span>=<span class="string">&quot;$ mkfs.vfat /dev/mmcblk%mmc%p1&quot;</span>&gt;</span>Formatting rootfs partition<span class="tag">&lt;/<span class="name">CMD</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">CMD</span> <span class="attr">state</span>=<span class="string">&quot;Updater&quot;</span> <span class="attr">type</span>=<span class="string">&quot;push&quot;</span> <span class="attr">body</span>=<span class="string">&quot;$ mkdir -p /mnt/mmcblk%mmc%p1&quot;</span>/&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">CMD</span> <span class="attr">state</span>=<span class="string">&quot;Updater&quot;</span> <span class="attr">type</span>=<span class="string">&quot;push&quot;</span> <span class="attr">body</span>=<span class="string">&quot;$ mount -t vfat /dev/mmcblk%mmc%p1 /mnt/mmcblk%mmc%p1&quot;</span>/&gt;</span></span><br></pre></td></tr></table></figure>

<p>这里吧%mmc%&#x3D;1替换一下就是：</p>
<figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag">&lt;<span class="name">CMD</span> <span class="attr">state</span>=<span class="string">&quot;Updater&quot;</span> <span class="attr">type</span>=<span class="string">&quot;push&quot;</span> <span class="attr">body</span>=<span class="string">&quot;$ while [ ! -e /dev/mmcblk1p1 ]; do sleep 1; echo \&quot;</span><span class="attr">waiting...</span>\&quot;; <span class="attr">done</span> &quot;&gt;</span>Waiting for the partition ready<span class="tag">&lt;/<span class="name">CMD</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">CMD</span> <span class="attr">state</span>=<span class="string">&quot;Updater&quot;</span> <span class="attr">type</span>=<span class="string">&quot;push&quot;</span> <span class="attr">body</span>=<span class="string">&quot;$ mkfs.vfat /dev/mmcblk1p1&quot;</span>&gt;</span>Formatting rootfs partition<span class="tag">&lt;/<span class="name">CMD</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">CMD</span> <span class="attr">state</span>=<span class="string">&quot;Updater&quot;</span> <span class="attr">type</span>=<span class="string">&quot;push&quot;</span> <span class="attr">body</span>=<span class="string">&quot;$ mkdir -p /mnt/mmcblk1p1&quot;</span>/&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">CMD</span> <span class="attr">state</span>=<span class="string">&quot;Updater&quot;</span> <span class="attr">type</span>=<span class="string">&quot;push&quot;</span> <span class="attr">body</span>=<span class="string">&quot;$ mount -t vfat /dev/mmcblk1p1 /mnt/mmcblk1p1&quot;</span>/&gt;</span></span><br></pre></td></tr></table></figure>

<p>这里先格式化分区，然后用mount命令挂载。</p>
<h4 id="6-5-4-Updater——burn-zImage"><a href="#6-5-4-Updater——burn-zImage" class="headerlink" title="6.5.4 Updater——burn zImage"></a><font size=3>6.5.4 Updater——burn zImage</font></h4><figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">&lt;!-- burn zImage --&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">CMD</span> <span class="attr">state</span>=<span class="string">&quot;Updater&quot;</span> <span class="attr">type</span>=<span class="string">&quot;push&quot;</span> <span class="attr">body</span>=<span class="string">&quot;send&quot;</span> <span class="attr">file</span>=<span class="string">&quot;files/zImage&quot;</span>&gt;</span>Sending kernel zImage<span class="tag">&lt;/<span class="name">CMD</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">CMD</span> <span class="attr">state</span>=<span class="string">&quot;Updater&quot;</span> <span class="attr">type</span>=<span class="string">&quot;push&quot;</span> <span class="attr">body</span>=<span class="string">&quot;$ cp $FILE /mnt/mmcblk%mmc%p1/zImage&quot;</span>&gt;</span>write kernel image to sd card<span class="tag">&lt;/<span class="name">CMD</span>&gt;</span></span><br></pre></td></tr></table></figure>

<p>这里就是烧写zImage文件，这里替换一下变量值就是：</p>
<figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">&lt;!-- burn zImage --&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">CMD</span> <span class="attr">state</span>=<span class="string">&quot;Updater&quot;</span> <span class="attr">type</span>=<span class="string">&quot;push&quot;</span> <span class="attr">body</span>=<span class="string">&quot;send&quot;</span> <span class="attr">file</span>=<span class="string">&quot;files/zImage&quot;</span>&gt;</span>Sending kernel zImage<span class="tag">&lt;/<span class="name">CMD</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">CMD</span> <span class="attr">state</span>=<span class="string">&quot;Updater&quot;</span> <span class="attr">type</span>=<span class="string">&quot;push&quot;</span> <span class="attr">body</span>=<span class="string">&quot;$ cp $FILE /mnt/mmcblk1p1/zImage&quot;</span>&gt;</span>write kernel image to sd card<span class="tag">&lt;/<span class="name">CMD</span>&gt;</span></span><br></pre></td></tr></table></figure>

<p>就是把zimage烧写到mmcblk1p1这个分区中。这里会先发送然后再拷贝，使用的文件是这个：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-02-NXP-mfgtool%E7%AE%80%E4%BB%8B/img/image-20241105065429877.png" alt="image-20241105065429877" />

<h4 id="6-5-5-Updater——burn-dtb"><a href="#6-5-5-Updater——burn-dtb" class="headerlink" title="6.5.5 Updater——burn dtb"></a><font size=3>6.5.5 Updater——burn dtb</font></h4><p>接下来是烧写设备树文件，这里只看MX6ULL的两行命令</p>
<figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag">&lt;<span class="name">CMD</span> <span class="attr">state</span>=<span class="string">&quot;Updater&quot;</span> <span class="attr">type</span>=<span class="string">&quot;push&quot;</span> <span class="attr">body</span>=<span class="string">&quot;send&quot;</span> <span class="attr">file</span>=<span class="string">&quot;files/zImage-imx6ul%lite%-%6uldtb%-emmc.dtb&quot;</span> <span class="attr">ifdev</span>=<span class="string">&quot;MX6ULL&quot;</span>&gt;</span>Sending Device Tree file<span class="tag">&lt;/<span class="name">CMD</span>&gt;</span></span><br><span class="line"></span><br><span class="line"><span class="tag">&lt;<span class="name">CMD</span> <span class="attr">state</span>=<span class="string">&quot;Updater&quot;</span> <span class="attr">type</span>=<span class="string">&quot;push&quot;</span> <span class="attr">body</span>=<span class="string">&quot;$ cp $FILE /mnt/mmcblk%mmc%p1/imx6ul%lite%-%6uldtb%.dtb&quot;</span> <span class="attr">ifdev</span>=<span class="string">&quot;MX6ULL&quot;</span>&gt;</span>write device tree to sd card<span class="tag">&lt;/<span class="name">CMD</span>&gt;</span></span><br></pre></td></tr></table></figure>

<p>变量值为：</p>
<figure class="highlight ini"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">mmc</span> = <span class="number">1</span></span><br><span class="line"><span class="attr">6uluboot</span>=<span class="number">14</span>x14evk</span><br><span class="line"><span class="attr">6uldtb</span>=<span class="number">14</span>x14-evk</span><br><span class="line"><span class="attr">6ulldtb</span>=<span class="number">14</span>x14-ddr3-arm2</span><br></pre></td></tr></table></figure>

<p>替换后如下所示：</p>
<figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag">&lt;<span class="name">CMD</span> <span class="attr">state</span>=<span class="string">&quot;Updater&quot;</span> <span class="attr">type</span>=<span class="string">&quot;push&quot;</span> <span class="attr">body</span>=<span class="string">&quot;send&quot;</span> <span class="attr">file</span>=<span class="string">&quot;files/zImage-imx6ull-14x14-evk-emmc.dtb&quot;</span> <span class="attr">ifdev</span>=<span class="string">&quot;MX6ULL&quot;</span>&gt;</span>Sending Device Tree file<span class="tag">&lt;/<span class="name">CMD</span>&gt;</span></span><br><span class="line"></span><br><span class="line"><span class="tag">&lt;<span class="name">CMD</span> <span class="attr">state</span>=<span class="string">&quot;Updater&quot;</span> <span class="attr">type</span>=<span class="string">&quot;push&quot;</span> <span class="attr">body</span>=<span class="string">&quot;$ cp $FILE /mnt/mmcblk1p1/imx6ull-14x14-evk.dtb&quot;</span> <span class="attr">ifdev</span>=<span class="string">&quot;MX6ULL&quot;</span>&gt;</span>write device tree to sd card<span class="tag">&lt;/<span class="name">CMD</span>&gt;</span></span><br></pre></td></tr></table></figure>

<p>这里有点奇怪，就是执行cp命令复制过程中把zImage-imx6ull-14x14-evk-emmc.dtb后面的-emmc去掉了，可能是内核中设备树名字的问题，反正这里知道是复制设备树到对应文件中就是了。</p>
<h4 id="6-5-6-Updater——burn-m4-demo-bins"><a href="#6-5-6-Updater——burn-m4-demo-bins" class="headerlink" title="6.5.6 Updater——burn m4 demo bins"></a><font size=3>6.5.6 Updater——burn m4 demo bins</font></h4><p>这个看起来是烧写一些demo文件：</p>
<figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">&lt;!-- burn m4 demo bins--&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">CMD</span> <span class="attr">state</span>=<span class="string">&quot;Updater&quot;</span> <span class="attr">type</span>=<span class="string">&quot;push&quot;</span> <span class="attr">body</span>=<span class="string">&quot;send&quot;</span> <span class="attr">file</span>=<span class="string">&quot;files/imx7d_sabresd_m4_TCM_helloworld.bin&quot;</span> <span class="attr">ifdev</span>=<span class="string">&quot;MX7D&quot;</span>&gt;</span>Sending helloworld demo<span class="tag">&lt;/<span class="name">CMD</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">CMD</span> <span class="attr">state</span>=<span class="string">&quot;Updater&quot;</span> <span class="attr">type</span>=<span class="string">&quot;push&quot;</span> <span class="attr">body</span>=<span class="string">&quot;$ cp $FILE /mnt/mmcblk%mmc%p1/imx7d_sabresd_m4_TCM_helloworld.bin&quot;</span> <span class="attr">ifdev</span>=<span class="string">&quot;MX7D&quot;</span>&gt;</span>write demo image to eMMC<span class="tag">&lt;/<span class="name">CMD</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">CMD</span> <span class="attr">state</span>=<span class="string">&quot;Updater&quot;</span> <span class="attr">type</span>=<span class="string">&quot;push&quot;</span> <span class="attr">body</span>=<span class="string">&quot;send&quot;</span> <span class="attr">file</span>=<span class="string">&quot;files/imx7d_sabresd_m4_TCM_mcctty.bin&quot;</span> <span class="attr">ifdev</span>=<span class="string">&quot;MX7D&quot;</span>&gt;</span>Sending mcctty demo<span class="tag">&lt;/<span class="name">CMD</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">CMD</span> <span class="attr">state</span>=<span class="string">&quot;Updater&quot;</span> <span class="attr">type</span>=<span class="string">&quot;push&quot;</span> <span class="attr">body</span>=<span class="string">&quot;$ cp $FILE /mnt/mmcblk%mmc%p1/imx7d_sabresd_m4_TCM_mcctty.bin&quot;</span> <span class="attr">ifdev</span>=<span class="string">&quot;MX7D&quot;</span>&gt;</span>write demo image to eMMC<span class="tag">&lt;/<span class="name">CMD</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">CMD</span> <span class="attr">state</span>=<span class="string">&quot;Updater&quot;</span> <span class="attr">type</span>=<span class="string">&quot;push&quot;</span> <span class="attr">body</span>=<span class="string">&quot;send&quot;</span> <span class="attr">file</span>=<span class="string">&quot;files/imx7d_sabresd_m4_TCM_Pingpang.bin&quot;</span> <span class="attr">ifdev</span>=<span class="string">&quot;MX7D&quot;</span>&gt;</span>Sending pingpong demo<span class="tag">&lt;/<span class="name">CMD</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">CMD</span> <span class="attr">state</span>=<span class="string">&quot;Updater&quot;</span> <span class="attr">type</span>=<span class="string">&quot;push&quot;</span> <span class="attr">body</span>=<span class="string">&quot;$ cp $FILE /mnt/mmcblk%mmc%p1/imx7d_sabresd_m4_TCM_Pingpang.bin&quot;</span> <span class="attr">ifdev</span>=<span class="string">&quot;MX7D&quot;</span>&gt;</span>write demo image to eMMC<span class="tag">&lt;/<span class="name">CMD</span>&gt;</span></span><br><span class="line"></span><br><span class="line"><span class="tag">&lt;<span class="name">CMD</span> <span class="attr">state</span>=<span class="string">&quot;Updater&quot;</span> <span class="attr">type</span>=<span class="string">&quot;push&quot;</span> <span class="attr">body</span>=<span class="string">&quot;$ umount /mnt/mmcblk%mmc%p1&quot;</span>&gt;</span>Unmounting vfat partition<span class="tag">&lt;/<span class="name">CMD</span>&gt;</span></span><br></pre></td></tr></table></figure>

<p>不过其实这里是MX7D才有，MX6ULL没有，这里就不用管了。这里烧写完后面把mmcblk1p1卸载。</p>
<h4 id="6-5-7-Updater——burn-rootfs"><a href="#6-5-7-Updater——burn-rootfs" class="headerlink" title="6.5.7 Updater——burn rootfs"></a><font size=3>6.5.7 Updater——burn rootfs</font></h4><p>接下来是烧写根文件系统：</p>
<figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag">&lt;<span class="name">CMD</span> <span class="attr">state</span>=<span class="string">&quot;Updater&quot;</span> <span class="attr">type</span>=<span class="string">&quot;push&quot;</span> <span class="attr">body</span>=<span class="string">&quot;$ mkfs.ext3 -F -E nodiscard /dev/mmcblk%mmc%p2&quot;</span>&gt;</span>Formatting rootfs partition<span class="tag">&lt;/<span class="name">CMD</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">CMD</span> <span class="attr">state</span>=<span class="string">&quot;Updater&quot;</span> <span class="attr">type</span>=<span class="string">&quot;push&quot;</span> <span class="attr">body</span>=<span class="string">&quot;$ mkdir -p /mnt/mmcblk%mmc%p2&quot;</span>/&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">CMD</span> <span class="attr">state</span>=<span class="string">&quot;Updater&quot;</span> <span class="attr">type</span>=<span class="string">&quot;push&quot;</span> <span class="attr">body</span>=<span class="string">&quot;$ mount -t ext3 /dev/mmcblk%mmc%p2 /mnt/mmcblk%mmc%p2&quot;</span>/&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">CMD</span> <span class="attr">state</span>=<span class="string">&quot;Updater&quot;</span> <span class="attr">type</span>=<span class="string">&quot;push&quot;</span> <span class="attr">body</span>=<span class="string">&quot;pipe tar -jxv -C /mnt/mmcblk%mmc%p2&quot;</span> <span class="attr">file</span>=<span class="string">&quot;files/rootfs.tar.bz2&quot;</span> <span class="attr">ifdev</span>=<span class="string">&quot;MX6SL MX6D MX6Q MX6SX&quot;</span>&gt;</span>Sending and writting rootfs<span class="tag">&lt;/<span class="name">CMD</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">CMD</span> <span class="attr">state</span>=<span class="string">&quot;Updater&quot;</span> <span class="attr">type</span>=<span class="string">&quot;push&quot;</span> <span class="attr">body</span>=<span class="string">&quot;pipe tar -jxv -C /mnt/mmcblk%mmc%p2&quot;</span> <span class="attr">file</span>=<span class="string">&quot;files/rootfs_nogpu.tar.bz2&quot;</span> <span class="attr">ifdev</span>=<span class="string">&quot;MX6UL MX7D MX6ULL&quot;</span>&gt;</span>Sending and writting rootfs<span class="tag">&lt;/<span class="name">CMD</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">CMD</span> <span class="attr">state</span>=<span class="string">&quot;Updater&quot;</span> <span class="attr">type</span>=<span class="string">&quot;push&quot;</span> <span class="attr">body</span>=<span class="string">&quot;frf&quot;</span>&gt;</span>Finishing rootfs write<span class="tag">&lt;/<span class="name">CMD</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">CMD</span> <span class="attr">state</span>=<span class="string">&quot;Updater&quot;</span> <span class="attr">type</span>=<span class="string">&quot;push&quot;</span> <span class="attr">body</span>=<span class="string">&quot;$ umount /mnt/mmcblk%mmc%p2&quot;</span>&gt;</span>Unmounting rootfs partition<span class="tag">&lt;/<span class="name">CMD</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">CMD</span> <span class="attr">state</span>=<span class="string">&quot;Updater&quot;</span> <span class="attr">type</span>=<span class="string">&quot;push&quot;</span> <span class="attr">body</span>=<span class="string">&quot;$ echo Update Complete!&quot;</span>&gt;</span>Done<span class="tag">&lt;/<span class="name">CMD</span>&gt;</span></span><br></pre></td></tr></table></figure>

<p>我们根据配置文件对变量进行替换：</p>
<figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag">&lt;<span class="name">CMD</span> <span class="attr">state</span>=<span class="string">&quot;Updater&quot;</span> <span class="attr">type</span>=<span class="string">&quot;push&quot;</span> <span class="attr">body</span>=<span class="string">&quot;$ mkfs.ext3 -F -E nodiscard /dev/mmcblk1p2&quot;</span>&gt;</span>Formatting rootfs partition<span class="tag">&lt;/<span class="name">CMD</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">CMD</span> <span class="attr">state</span>=<span class="string">&quot;Updater&quot;</span> <span class="attr">type</span>=<span class="string">&quot;push&quot;</span> <span class="attr">body</span>=<span class="string">&quot;$ mkdir -p /mnt/mmcblk1p2&quot;</span>/&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">CMD</span> <span class="attr">state</span>=<span class="string">&quot;Updater&quot;</span> <span class="attr">type</span>=<span class="string">&quot;push&quot;</span> <span class="attr">body</span>=<span class="string">&quot;$ mount -t ext3 /dev/mmcblk1p2 /mnt/mmcblk1p2&quot;</span>/&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">CMD</span> <span class="attr">state</span>=<span class="string">&quot;Updater&quot;</span> <span class="attr">type</span>=<span class="string">&quot;push&quot;</span> <span class="attr">body</span>=<span class="string">&quot;pipe tar -jxv -C /mnt/mmcblk1p2&quot;</span> <span class="attr">file</span>=<span class="string">&quot;files/rootfs.tar.bz2&quot;</span> <span class="attr">ifdev</span>=<span class="string">&quot;MX6SL MX6D MX6Q MX6SX&quot;</span>&gt;</span>Sending and writting rootfs<span class="tag">&lt;/<span class="name">CMD</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">CMD</span> <span class="attr">state</span>=<span class="string">&quot;Updater&quot;</span> <span class="attr">type</span>=<span class="string">&quot;push&quot;</span> <span class="attr">body</span>=<span class="string">&quot;pipe tar -jxv -C /mnt/mmcblk1p2&quot;</span> <span class="attr">file</span>=<span class="string">&quot;files/rootfs_nogpu.tar.bz2&quot;</span> <span class="attr">ifdev</span>=<span class="string">&quot;MX6UL MX7D MX6ULL&quot;</span>&gt;</span>Sending and writting rootfs<span class="tag">&lt;/<span class="name">CMD</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">CMD</span> <span class="attr">state</span>=<span class="string">&quot;Updater&quot;</span> <span class="attr">type</span>=<span class="string">&quot;push&quot;</span> <span class="attr">body</span>=<span class="string">&quot;frf&quot;</span>&gt;</span>Finishing rootfs write<span class="tag">&lt;/<span class="name">CMD</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">CMD</span> <span class="attr">state</span>=<span class="string">&quot;Updater&quot;</span> <span class="attr">type</span>=<span class="string">&quot;push&quot;</span> <span class="attr">body</span>=<span class="string">&quot;$ umount /mnt/mmcblk1p2&quot;</span>&gt;</span>Unmounting rootfs partition<span class="tag">&lt;/<span class="name">CMD</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">CMD</span> <span class="attr">state</span>=<span class="string">&quot;Updater&quot;</span> <span class="attr">type</span>=<span class="string">&quot;push&quot;</span> <span class="attr">body</span>=<span class="string">&quot;$ echo Update Complete!&quot;</span>&gt;</span>Done<span class="tag">&lt;/<span class="name">CMD</span>&gt;</span></span><br></pre></td></tr></table></figure>

<p>一开始也是格式化了一个分区&#x2F;dev&#x2F;mmcblk1p2，然后对其进行挂载：</p>
<figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag">&lt;<span class="name">CMD</span> <span class="attr">state</span>=<span class="string">&quot;Updater&quot;</span> <span class="attr">type</span>=<span class="string">&quot;push&quot;</span> <span class="attr">body</span>=<span class="string">&quot;$ mkfs.ext3 -F -E nodiscard /dev/mmcblk1p2&quot;</span>&gt;</span>Formatting rootfs partition<span class="tag">&lt;/<span class="name">CMD</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">CMD</span> <span class="attr">state</span>=<span class="string">&quot;Updater&quot;</span> <span class="attr">type</span>=<span class="string">&quot;push&quot;</span> <span class="attr">body</span>=<span class="string">&quot;$ mkdir -p /mnt/mmcblk1p2&quot;</span>/&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">CMD</span> <span class="attr">state</span>=<span class="string">&quot;Updater&quot;</span> <span class="attr">type</span>=<span class="string">&quot;push&quot;</span> <span class="attr">body</span>=<span class="string">&quot;$ mount -t ext3 /dev/mmcblk1p2 /mnt/mmcblk1p2&quot;</span>/&gt;</span></span><br></pre></td></tr></table></figure>

<p>接下来是发送和写入根文件系统：</p>
<figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag">&lt;<span class="name">CMD</span> <span class="attr">state</span>=<span class="string">&quot;Updater&quot;</span> <span class="attr">type</span>=<span class="string">&quot;push&quot;</span> <span class="attr">body</span>=<span class="string">&quot;pipe tar -jxv -C /mnt/mmcblk1p2&quot;</span> <span class="attr">file</span>=<span class="string">&quot;files/rootfs.tar.bz2&quot;</span> <span class="attr">ifdev</span>=<span class="string">&quot;MX6SL MX6D MX6Q MX6SX&quot;</span>&gt;</span>Sending and writting rootfs<span class="tag">&lt;/<span class="name">CMD</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">CMD</span> <span class="attr">state</span>=<span class="string">&quot;Updater&quot;</span> <span class="attr">type</span>=<span class="string">&quot;push&quot;</span> <span class="attr">body</span>=<span class="string">&quot;pipe tar -jxv -C /mnt/mmcblk1p2&quot;</span> <span class="attr">file</span>=<span class="string">&quot;files/rootfs_nogpu.tar.bz2&quot;</span> <span class="attr">ifdev</span>=<span class="string">&quot;MX6UL MX7D MX6ULL&quot;</span>&gt;</span>Sending and writting rootfs<span class="tag">&lt;/<span class="name">CMD</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">CMD</span> <span class="attr">state</span>=<span class="string">&quot;Updater&quot;</span> <span class="attr">type</span>=<span class="string">&quot;push&quot;</span> <span class="attr">body</span>=<span class="string">&quot;frf&quot;</span>&gt;</span>Finishing rootfs write<span class="tag">&lt;/<span class="name">CMD</span>&gt;</span></span><br></pre></td></tr></table></figure>

<p>这里这个pipe tar命令有点没看懂，网上搜了下也没见这么用的，我猜测是pipe是管道，这个命令直接把根文件系统解压后写入mmcblk1p2这个分区，这里我们使用的是MX6ULL，所以这里根文件系统是ootfs_nogpu.tar.bz2：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-02-NXP-mfgtool%E7%AE%80%E4%BB%8B/img/image-20241105071304417.png" alt="image-20241105071304417" />

<p>这个根文件系统包不包含rootfs这一级目录？解压后直接是根文件系统？我们解压看一下，为防止一堆文件出现，我们先创建一个目录：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">cd /d/devSoftware/L4.1.15_2.0.0-ga_mfg-tools/mfgtools-with-rootfs/mfgtools/Profiles/Linux/OS\ Firmware/files</span><br><span class="line">mkdir temp</span><br><span class="line">cp rootfs_nogpu.tar.bz2 temp/</span><br><span class="line">cd temp</span><br><span class="line">tar xf rootfs_nogpu.tar.bz2</span><br></pre></td></tr></table></figure>

<p>这里需要注意，由于是linux根文件系统，这里会存储在大量的软链接，而windows下是没有软链接的概念的，所以这些文件解压时会报错，不用管，我们只是看看顶层目录长啥样而已。然后我们看一下这个目录：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-02-NXP-mfgtool%E7%AE%80%E4%BB%8B/img/image-20241105071750420.png" alt="image-20241105071750420" />

<p>会发现直接就是根文件系统了，所以我么打包的时候也要注意，要保证解压出来的文件不在压缩包名的子目录中。到这里，烧写的第二阶段就结束了，之后就可以将拨码开关拨到eMMC启动，就可以启动系统了。</p>
<h4 id="6-5-8-Updater——总结"><a href="#6-5-8-Updater——总结" class="headerlink" title="6.5.8 Updater——总结"></a><font size=3>6.5.8 Updater——总结</font></h4><p>第二阶段烧写了哪些文件？</p>
<table>
    <tbody>
        <tr>
            <td style="text-align: center">固件</td>
            <td style="text-align: center">下载文件</td>
        </tr>
        <tr>
            <td style="text-align: center">uboot</td>
            <td>files/u-boot-imx6ull14x14evk_emmc.imx</td>
        </tr>
        <tr>
            <td style="text-align: center">kernel</td>
            <td>files/zImage</td>
        </tr>
        <tr>
            <td style="text-align: center">dtb</td>
            <td>files/zImage-imx6ull-14x14-evk-emmc.dtb</td>
        </tr>
        <tr>
            <td style="text-align: center">rootfs</td>
            <td>files/rootfs_nogpu.tar.bz2</td>
        </tr>
    </tbody>
</table>



<h1 id="三、NXP官方系统烧写"><a href="#三、NXP官方系统烧写" class="headerlink" title="三、NXP官方系统烧写"></a><font size=3>三、NXP官方系统烧写</font></h1><h2 id="1-系统烧写到EMMC"><a href="#1-系统烧写到EMMC" class="headerlink" title="1. 系统烧写到EMMC"></a><font size=3>1. 系统烧写到EMMC</font></h2><p>我们先来体验一下将NXP官方的镜像烧写到正点原子的开发板中，简单了解一下烧写过程。正点原子的 EMMC 核心版用的也是 512MB 的 DDR3 加 8G 的 EMMC，因此烧写 NXP 官方的系统是没有任何问题的。基本步骤如下：</p>
<ul>
<li><p>（1）连接好 USB，拨码开关拨到 USB 下载模式。</p>
</li>
<li><p>（2）弹出 TF 卡，然后按下开发板复位按键，后续将系统烧写到EMMC中去，所以不需要 TF 卡。</p>
</li>
<li><p>（3）打开 MobaXterm，连接开发板，注意，此时需要两根USB线，一个连接在USB OTG，用于烧写程序，另一个连接在串口，用于显示开发板串口的打印信息。</p>
</li>
</ul>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-02-NXP-mfgtool%E7%AE%80%E4%BB%8B/img/image-20230714181213952.png" alt="image-20230714181213952" style="zoom: 33%;" />

<ul>
<li>（4）双击“mfgtool2-yocto-mx-evk-emmc.vbs”，打开下载软件，如果出现【符合 HID 标准的供应商定义设备】等字样就说明下载软件已经准备就绪。</li>
</ul>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-02-NXP-mfgtool%E7%AE%80%E4%BB%8B/img/image-20230714181753981.png" alt="image-20230714181753981" style="zoom:50%;" />

<ul>
<li>（5）点击【Start】按钮开发烧写 NXP 官方系统，在uboot烧写完成并启动后，串口就会有打印信息输出。烧写过程如图所示：</li>
</ul>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-02-NXP-mfgtool%E7%AE%80%E4%BB%8B/img/image-20230714181855110.png" alt="image-20230714181855110" style="zoom: 27%;" />

<p>然后我们可以在 MobaXterm 中看到当前的烧写过程，过程很漫长（主要是烧写根文件系统有大量的文件要拷贝，就很慢），这里就截取了一部分。</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-02-NXP-mfgtool%E7%AE%80%E4%BB%8B/img/image-20230714182112631.png" alt="image-20230714182112631" style="zoom:33%;" />

<ul>
<li>（6）烧写完成状态如下图所示：</li>
</ul>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-02-NXP-mfgtool%E7%AE%80%E4%BB%8B/img/image-20221023145536704.png" alt="image-20221023145536704" style="zoom:50%;" />

<ul>
<li>（7）然后我们点击【Stop】，最后点击【Exit】退出即可。</li>
</ul>
<h2 id="2-重启测试"><a href="#2-重启测试" class="headerlink" title="2. 重启测试"></a><font size=3>2. 重启测试</font></h2><p>上边烧写完毕后，我们拔出 USB 线，将开发板上的拨码开关拨到 EMMC 启动模式(1010 0110)，然后重启开发板，此时就会从 EMMC 启动。只是启动以后的系统是 NXP 官方给 I.MX6ULL EVK 开发板制作的，这个系统需要输入用户名，用户名为“root”，没有密码，如下图： </p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-02-NXP-mfgtool%E7%AE%80%E4%BB%8B/img/image-20230714183618441.png" alt="image-20230714183618441" style="zoom:50%;" />

<p>在“imx6ul7d login：”后面输入“root”用户名，然后点击回车键即可进入系统中，进入系统以后就可以进行其他操作了。由此可以看出，NXP 官方的系统其实是可以在正点原子的 EMMC 版核心板上运行的 。 正常来讲，若是有显示屏，则也会有一些显示信息，但是可能不清楚，并且位置也不是很对：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-02-NXP-mfgtool%E7%AE%80%E4%BB%8B/img/image-20230714183832269.png" alt="image-20230714183832269" style="zoom:50%;" />

<h1 id="四、改造自己的烧写工具？"><a href="#四、改造自己的烧写工具？" class="headerlink" title="四、改造自己的烧写工具？"></a><font size=3>四、改造自己的烧写工具？</font></h1><p>上边的目录里边有很多我们不需要的文件，看着挺烦人的，我们最少需要哪些文件？这一部分我们以官方的系统为例进行一个学习。我们这里就以EMMC为例进行学习说明，SD卡和NAND也是一样的步骤。</p>
<h2 id="1-准备工具目录"><a href="#1-准备工具目录" class="headerlink" title="1. 准备工具目录"></a><font size=3>1. 准备工具目录</font></h2><p>我们复制一个 mfgtools-with-rootfs 目录，然后重命名：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-02-NXP-mfgtool%E7%AE%80%E4%BB%8B/img/image-20230715090438259.png" alt="image-20230715090438259" style="zoom:50%;" />

<p>接着我们删除其中的 mfgtools-with-rootfs-mine&#x2F;mfgtools&#x2F;*.vbs 文件，再删除 mfgtools-with-rootfs-mine&#x2F;mfgtools&#x2F;Profiles&#x2F;Linux&#x2F;OS Firmware目录中的 files 目录、firmware 目录和ulc2.xml文件，这些删除的东西我们后边都会重新创建并修改，最终创建一个自己的mfgtool。</p>
<h2 id="2-文件准备"><a href="#2-文件准备" class="headerlink" title="2. 文件准备"></a><font size=3>2. 文件准备</font></h2><h3 id="2-1-files目录文件"><a href="#2-1-files目录文件" class="headerlink" title="2.1 files目录文件"></a><font size=3>2.1 files目录文件</font></h3><p>我们的files目录需要那些文件？其实我们只需要四个文件：u-boot、linux内核镜像、dtb设备树和rootfs根文件系统，我们使用的是EMMC的板子，所以我们可以从官方的 mfgtool 中的OS Firmware目录中找到这些文件，我们直接复制到自己的目录中：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-02-NXP-mfgtool%E7%AE%80%E4%BB%8B/img/image-20230715095029133.png" alt="image-20230715095029133" style="zoom:50%;" />

<h3 id="2-2-firmware目录文件"><a href="#2-2-firmware目录文件" class="headerlink" title="2.2 firmware目录文件"></a><font size=3>2.2 firmware目录文件</font></h3><p>firmware目录文件需要u-boot、linux内核和dtb，在这个里边不需要根文件系统，firmware目录中的文件主要是完成烧写的第一个过程。我们也可以从mfgtool 中的OS Firmware目录中找到这些文件，我们直接复制到自己的目录中：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-02-NXP-mfgtool%E7%AE%80%E4%BB%8B/img/image-20230715095123022.png" alt="image-20230715095123022" style="zoom:50%;" />

<p>firmware 目录下的 fsl-image-mfgtool-initramfs-imx_mfgtools.cpio.gz.u-boot 文件（后边好像用到了，所以这里就一起拷贝一下啦，但是做什么用没有深究）。</p>
<h3 id="2-3-新建-vbs-文件"><a href="#2-3-新建-vbs-文件" class="headerlink" title="2.3 新建 .vbs 文件"></a><font size=3>2.3 新建 .vbs 文件</font></h3><p>vbs文件用于调用mfgtool.exe烧写工具，并传入相关参数的，我们需要重新自己新建一个自己的，我们直接复制 mfgtool2-yocto-mx-evk-emmc.vbs 文件到 mfgtools-with-rootfs-mine&#x2F;mfgtools目录即可（当然也可以命名为其他），文件内容不要做任何修改， .vbs 文件我们就新建好了。文件内容如下：</p>
<figure class="highlight vbscript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">Set</span> wshShell = <span class="built_in">CreateObject</span>(<span class="string">&quot;WScript.shell&quot;</span>)</span><br><span class="line">wshShell.run <span class="string">&quot;mfgtool2.exe -c &quot;&quot;linux&quot;&quot; -l &quot;&quot;eMMC&quot;&quot; -s &quot;&quot;board=sabresd&quot;&quot; -s &quot;&quot;mmc=1&quot;&quot; -s &quot;&quot;6uluboot=14x14evk&quot;&quot; -s &quot;&quot;6uldtb=14x14-evk&quot;&quot;&quot;</span></span><br><span class="line"><span class="keyword">Set</span> wshShell = <span class="literal">Nothing</span></span><br></pre></td></tr></table></figure>

<p>在此脚本下，后边我们在ucl2.xml文件中遇到%6uluboot%就会被替换为14x14evk，遇到 %6uldtb%会被替换为14x14-evk，但是后边在这里自定义的可以直接写死，在实际开发需要支持多种芯片的时候可以采用此种方法传递参数，然后我们可以在 ucl2.xml 中通过 %variable_name%来引用。</p>
<p>【注意】这里的其实是修改了 mfgtools-with-rootfs-mine&#x2F;mfgtools&#x2F;cfg.ini中的参数，cfg.ini文件中是默认的配置，要修改的话就在脚本中修改，重新传入即可。</p>
<h3 id="2-4-新建-ucl2-xml-文件"><a href="#2-4-新建-ucl2-xml-文件" class="headerlink" title="2.4 新建 ucl2.xml 文件"></a><font size=3>2.4 新建 ucl2.xml 文件</font></h3><p>ucl2.xml文件位于mfgtools-with-rootfs-mine&#x2F;mfgtools&#x2F;Profiles&#x2F;Linux&#x2F;OS Firmware目录下，它决定了mfgtool的烧写的详细过程以及烧写的文件。我们新建一个ucl2.xml文件（也可以复制原来的进行修改）：</p>
<details class="folding-tag" blue><summary> 点击查看 ulc2.xml文件内容 </summary>
              <div class='content'>
              <figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">&lt;!--</span></span><br><span class="line"><span class="comment">* Copyright (C) 2012, Freescale Semiconductor, Inc. All Rights Reserved.</span></span><br><span class="line"><span class="comment">* The CFG element contains a list of recognized usb devices.</span></span><br><span class="line"><span class="comment">*  DEV elements provide a name, class, vid and pid for each device.</span></span><br><span class="line"><span class="comment">*</span></span><br><span class="line"><span class="comment">* Each LIST element contains a list of update instructions.</span></span><br><span class="line"><span class="comment">*  &quot;Install&quot; - Erase media and install firmware.</span></span><br><span class="line"><span class="comment">*  &quot;Update&quot; - Update firmware only.</span></span><br><span class="line"><span class="comment">*</span></span><br><span class="line"><span class="comment">* Each CMD element contains one update instruction of attribute type.</span></span><br><span class="line"><span class="comment">*  &quot;pull&quot; - Does UtpRead(body, file) transaction.</span></span><br><span class="line"><span class="comment">*  &quot;push&quot; - Does UtpWrite(body, file) transaction.</span></span><br><span class="line"><span class="comment">*  &quot;drop&quot; - Does UtpCommand(body) then waits for device to disconnect.</span></span><br><span class="line"><span class="comment">*  &quot;boot&quot; - Finds configured device, forces it to &quot;body&quot; device and downloads &quot;file&quot;.</span></span><br><span class="line"><span class="comment">*  &quot;find&quot; - Waits for &quot;timeout&quot; seconds for the &quot;body&quot; device to connect.</span></span><br><span class="line"><span class="comment">*  &quot;show&quot; - Parse and show device info in &quot;file&quot;.  </span></span><br><span class="line"><span class="comment">--&gt;</span></span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="tag">&lt;<span class="name">UCL</span>&gt;</span></span><br><span class="line">  <span class="tag">&lt;<span class="name">CFG</span>&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">STATE</span> <span class="attr">name</span>=<span class="string">&quot;BootStrap&quot;</span> <span class="attr">dev</span>=<span class="string">&quot;MX6ULL&quot;</span> <span class="attr">vid</span>=<span class="string">&quot;15A2&quot;</span> <span class="attr">pid</span>=<span class="string">&quot;0080&quot;</span>/&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">STATE</span> <span class="attr">name</span>=<span class="string">&quot;Updater&quot;</span>   <span class="attr">dev</span>=<span class="string">&quot;MSC&quot;</span> <span class="attr">vid</span>=<span class="string">&quot;066F&quot;</span> <span class="attr">pid</span>=<span class="string">&quot;37FF&quot;</span>/&gt;</span></span><br><span class="line">  <span class="tag">&lt;/<span class="name">CFG</span>&gt;</span></span><br><span class="line"></span><br><span class="line">  <span class="tag">&lt;<span class="name">LIST</span> <span class="attr">name</span>=<span class="string">&quot;eMMC&quot;</span> <span class="attr">desc</span>=<span class="string">&quot;Choose eMMC as media&quot;</span>&gt;</span></span><br><span class="line">    <span class="comment">&lt;!-- firmware/u-boot-imx6ull14x14evk_emmc.imx (lite=&quot;l&quot;  6uluboot=&quot;14x14evk&quot;) --&gt;</span></span><br><span class="line">	<span class="tag">&lt;<span class="name">CMD</span> <span class="attr">state</span>=<span class="string">&quot;BootStrap&quot;</span> <span class="attr">type</span>=<span class="string">&quot;boot&quot;</span> <span class="attr">body</span>=<span class="string">&quot;BootStrap&quot;</span> <span class="attr">file</span> =<span class="string">&quot;firmware/u-boot-imx6ul%lite%%6uluboot%_emmc.imx&quot;</span> <span class="attr">ifdev</span>=<span class="string">&quot;MX6ULL&quot;</span>&gt;</span>Loading U-boot<span class="tag">&lt;/<span class="name">CMD</span>&gt;</span></span><br><span class="line">	<span class="comment">&lt;!-- firmware/zImage --&gt;</span></span><br><span class="line">	<span class="tag">&lt;<span class="name">CMD</span> <span class="attr">state</span>=<span class="string">&quot;BootStrap&quot;</span> <span class="attr">type</span>=<span class="string">&quot;load&quot;</span> <span class="attr">file</span>=<span class="string">&quot;firmware/zImage&quot;</span> <span class="attr">address</span>=<span class="string">&quot;0x80800000&quot;</span></span></span><br><span class="line"><span class="tag">		<span class="attr">loadSection</span>=<span class="string">&quot;OTH&quot;</span> <span class="attr">setSection</span>=<span class="string">&quot;OTH&quot;</span> <span class="attr">HasFlashHeader</span>=<span class="string">&quot;FALSE&quot;</span> <span class="attr">ifdev</span>=<span class="string">&quot;MX6SL MX6SX MX7D MX6UL MX6ULL&quot;</span>&gt;</span>Loading Kernel.<span class="tag">&lt;/<span class="name">CMD</span>&gt;</span></span><br><span class="line">    <span class="comment">&lt;!-- firmware/fsl-image-mfgtool-initramfs-imx_mfgtools.cpio.gz.u-boot --&gt;</span></span><br><span class="line">	<span class="tag">&lt;<span class="name">CMD</span> <span class="attr">state</span>=<span class="string">&quot;BootStrap&quot;</span> <span class="attr">type</span>=<span class="string">&quot;load&quot;</span> <span class="attr">file</span>=<span class="string">&quot;firmware/%initramfs%&quot;</span> <span class="attr">address</span>=<span class="string">&quot;0x83800000&quot;</span></span></span><br><span class="line"><span class="tag">		<span class="attr">loadSection</span>=<span class="string">&quot;OTH&quot;</span> <span class="attr">setSection</span>=<span class="string">&quot;OTH&quot;</span> <span class="attr">HasFlashHeader</span>=<span class="string">&quot;FALSE&quot;</span> <span class="attr">ifdev</span>=<span class="string">&quot;MX6SL MX6SX MX7D MX6UL MX6ULL&quot;</span>&gt;</span>Loading Initramfs.<span class="tag">&lt;/<span class="name">CMD</span>&gt;</span></span><br><span class="line">	<span class="comment">&lt;!-- firmware/zImage-imx6ull-14x14evk-emmc.dtb (lite=&quot;l&quot;  6uldtb=&quot;14x14evk&quot;) --&gt;</span></span><br><span class="line">	<span class="tag">&lt;<span class="name">CMD</span> <span class="attr">state</span>=<span class="string">&quot;BootStrap&quot;</span> <span class="attr">type</span>=<span class="string">&quot;load&quot;</span> <span class="attr">file</span>=<span class="string">&quot;firmware/zImage-imx6ul%lite%-%6uldtb%-emmc.dtb&quot;</span> <span class="attr">address</span>=<span class="string">&quot;0x83000000&quot;</span></span></span><br><span class="line"><span class="tag">		<span class="attr">loadSection</span>=<span class="string">&quot;OTH&quot;</span> <span class="attr">setSection</span>=<span class="string">&quot;OTH&quot;</span> <span class="attr">HasFlashHeader</span>=<span class="string">&quot;FALSE&quot;</span> <span class="attr">ifdev</span>=<span class="string">&quot;MX6ULL&quot;</span>&gt;</span>Loading device tree.<span class="tag">&lt;/<span class="name">CMD</span>&gt;</span></span><br><span class="line"></span><br><span class="line">	<span class="tag">&lt;<span class="name">CMD</span> <span class="attr">state</span>=<span class="string">&quot;BootStrap&quot;</span> <span class="attr">type</span>=<span class="string">&quot;jump&quot;</span> &gt;</span> Jumping to OS image. <span class="tag">&lt;/<span class="name">CMD</span>&gt;</span></span><br><span class="line"></span><br><span class="line">	<span class="comment">&lt;!-- create partition --&gt;</span></span><br><span class="line">	<span class="tag">&lt;<span class="name">CMD</span> <span class="attr">state</span>=<span class="string">&quot;Updater&quot;</span> <span class="attr">type</span>=<span class="string">&quot;push&quot;</span> <span class="attr">body</span>=<span class="string">&quot;send&quot;</span> <span class="attr">file</span>=<span class="string">&quot;mksdcard.sh.tar&quot;</span>&gt;</span>Sending partition shell<span class="tag">&lt;/<span class="name">CMD</span>&gt;</span> </span><br><span class="line">	<span class="tag">&lt;<span class="name">CMD</span> <span class="attr">state</span>=<span class="string">&quot;Updater&quot;</span> <span class="attr">type</span>=<span class="string">&quot;push&quot;</span> <span class="attr">body</span>=<span class="string">&quot;$ tar xf $FILE &quot;</span>&gt;</span> Partitioning...<span class="tag">&lt;/<span class="name">CMD</span>&gt;</span></span><br><span class="line">	<span class="tag">&lt;<span class="name">CMD</span> <span class="attr">state</span>=<span class="string">&quot;Updater&quot;</span> <span class="attr">type</span>=<span class="string">&quot;push&quot;</span> <span class="attr">body</span>=<span class="string">&quot;$ sh mksdcard.sh /dev/mmcblk%mmc%&quot;</span>&gt;</span> Partitioning...<span class="tag">&lt;/<span class="name">CMD</span>&gt;</span></span><br><span class="line"></span><br><span class="line">	<span class="comment">&lt;!-- burn uboot --&gt;</span></span><br><span class="line">	<span class="tag">&lt;<span class="name">CMD</span> <span class="attr">state</span>=<span class="string">&quot;Updater&quot;</span> <span class="attr">type</span>=<span class="string">&quot;push&quot;</span> <span class="attr">body</span>=<span class="string">&quot;$ dd if=/dev/zero of=/dev/mmcblk%mmc% bs=1k seek=768 conv=fsync count=8&quot;</span>&gt;</span>clear u-boot arg<span class="tag">&lt;/<span class="name">CMD</span>&gt;</span></span><br><span class="line">	<span class="comment">&lt;!-- access boot partition --&gt;</span></span><br><span class="line">	<span class="comment">&lt;!-- files/u-boot-imx6ull14x14evk_emmc.imx (lite=&quot;l&quot;  6uluboot=&quot;14x14evk&quot;)  --&gt;</span></span><br><span class="line">	<span class="tag">&lt;<span class="name">CMD</span> <span class="attr">state</span>=<span class="string">&quot;Updater&quot;</span> <span class="attr">type</span>=<span class="string">&quot;push&quot;</span> <span class="attr">body</span>=<span class="string">&quot;$ echo 0 &gt; /sys/block/mmcblk%mmc%boot0/force_ro&quot;</span>&gt;</span>access boot partition 1<span class="tag">&lt;/<span class="name">CMD</span>&gt;</span><span class="comment">&lt;!-- 取消分区只读保护 --&gt;</span></span><br><span class="line">	<span class="tag">&lt;<span class="name">CMD</span> <span class="attr">state</span>=<span class="string">&quot;Updater&quot;</span> <span class="attr">type</span>=<span class="string">&quot;push&quot;</span> <span class="attr">body</span>=<span class="string">&quot;send&quot;</span> <span class="attr">file</span>=<span class="string">&quot;files/u-boot-imx6ul%lite%%6uluboot%_emmc.imx&quot;</span> <span class="attr">ifdev</span>=<span class="string">&quot;MX6ULL&quot;</span>&gt;</span>Sending u-boot.bin<span class="tag">&lt;/<span class="name">CMD</span>&gt;</span></span><br><span class="line">	<span class="tag">&lt;<span class="name">CMD</span> <span class="attr">state</span>=<span class="string">&quot;Updater&quot;</span> <span class="attr">type</span>=<span class="string">&quot;push&quot;</span> <span class="attr">body</span>=<span class="string">&quot;$ dd if=$FILE of=/dev/mmcblk%mmc%boot0 bs=512 seek=2&quot;</span>&gt;</span>write U-Boot to eMMC<span class="tag">&lt;/<span class="name">CMD</span>&gt;</span></span><br><span class="line">	<span class="tag">&lt;<span class="name">CMD</span> <span class="attr">state</span>=<span class="string">&quot;Updater&quot;</span> <span class="attr">type</span>=<span class="string">&quot;push&quot;</span> <span class="attr">body</span>=<span class="string">&quot;$ echo 1 &gt; /sys/block/mmcblk%mmc%boot0/force_ro&quot;</span>&gt;</span> re-enable read-only access <span class="tag">&lt;/<span class="name">CMD</span>&gt;</span><span class="comment">&lt;!-- 开启分区只读保护 --&gt;</span></span><br><span class="line">	<span class="tag">&lt;<span class="name">CMD</span> <span class="attr">state</span>=<span class="string">&quot;Updater&quot;</span> <span class="attr">type</span>=<span class="string">&quot;push&quot;</span> <span class="attr">body</span>=<span class="string">&quot;$ mmc bootpart enable 1 1 /dev/mmcblk%mmc%&quot;</span>&gt;</span>enable boot partion 1 to boot<span class="tag">&lt;/<span class="name">CMD</span>&gt;</span></span><br><span class="line"></span><br><span class="line">	<span class="comment">&lt;!-- create fat partition --&gt;</span></span><br><span class="line">	<span class="tag">&lt;<span class="name">CMD</span> <span class="attr">state</span>=<span class="string">&quot;Updater&quot;</span> <span class="attr">type</span>=<span class="string">&quot;push&quot;</span> <span class="attr">body</span>=<span class="string">&quot;$ while [ ! -e /dev/mmcblk%mmc%p1 ]; do sleep 1; echo \&quot;</span><span class="attr">waiting...</span>\&quot;; <span class="attr">done</span> &quot;&gt;</span>Waiting for the partition ready<span class="tag">&lt;/<span class="name">CMD</span>&gt;</span></span><br><span class="line">	<span class="tag">&lt;<span class="name">CMD</span> <span class="attr">state</span>=<span class="string">&quot;Updater&quot;</span> <span class="attr">type</span>=<span class="string">&quot;push&quot;</span> <span class="attr">body</span>=<span class="string">&quot;$ mkfs.vfat /dev/mmcblk%mmc%p1&quot;</span>&gt;</span>Formatting rootfs partition<span class="tag">&lt;/<span class="name">CMD</span>&gt;</span></span><br><span class="line">	<span class="tag">&lt;<span class="name">CMD</span> <span class="attr">state</span>=<span class="string">&quot;Updater&quot;</span> <span class="attr">type</span>=<span class="string">&quot;push&quot;</span> <span class="attr">body</span>=<span class="string">&quot;$ mkdir -p /mnt/mmcblk%mmc%p1&quot;</span>/&gt;</span></span><br><span class="line">	<span class="tag">&lt;<span class="name">CMD</span> <span class="attr">state</span>=<span class="string">&quot;Updater&quot;</span> <span class="attr">type</span>=<span class="string">&quot;push&quot;</span> <span class="attr">body</span>=<span class="string">&quot;$ mount -t vfat /dev/mmcblk%mmc%p1 /mnt/mmcblk%mmc%p1&quot;</span>/&gt;</span></span><br><span class="line"></span><br><span class="line">	<span class="comment">&lt;!-- burn zImage --&gt;</span></span><br><span class="line">    <span class="comment">&lt;!-- files/zImage --&gt;</span></span><br><span class="line">	<span class="tag">&lt;<span class="name">CMD</span> <span class="attr">state</span>=<span class="string">&quot;Updater&quot;</span> <span class="attr">type</span>=<span class="string">&quot;push&quot;</span> <span class="attr">body</span>=<span class="string">&quot;send&quot;</span> <span class="attr">file</span>=<span class="string">&quot;files/zImage&quot;</span>&gt;</span>Sending kernel zImage<span class="tag">&lt;/<span class="name">CMD</span>&gt;</span></span><br><span class="line">	<span class="tag">&lt;<span class="name">CMD</span> <span class="attr">state</span>=<span class="string">&quot;Updater&quot;</span> <span class="attr">type</span>=<span class="string">&quot;push&quot;</span> <span class="attr">body</span>=<span class="string">&quot;$ cp $FILE /mnt/mmcblk%mmc%p1/zImage&quot;</span>&gt;</span>write kernel image to eMMC<span class="tag">&lt;/<span class="name">CMD</span>&gt;</span></span><br><span class="line"></span><br><span class="line">	<span class="comment">&lt;!-- burn dtb --&gt;</span></span><br><span class="line">    <span class="comment">&lt;!-- files/zImage-imx6ull-14x14evk-emmc.dtb (lite=&quot;l&quot;  6uldtb=&quot;14x14-evk&quot;) --&gt;</span></span><br><span class="line">	<span class="tag">&lt;<span class="name">CMD</span> <span class="attr">state</span>=<span class="string">&quot;Updater&quot;</span> <span class="attr">type</span>=<span class="string">&quot;push&quot;</span> <span class="attr">body</span>=<span class="string">&quot;send&quot;</span> <span class="attr">file</span>=<span class="string">&quot;files/zImage-imx6ul%lite%-%6uldtb%-emmc.dtb&quot;</span> <span class="attr">ifdev</span>=<span class="string">&quot;MX6ULL&quot;</span>&gt;</span>Sending Device Tree file<span class="tag">&lt;/<span class="name">CMD</span>&gt;</span></span><br><span class="line">	<span class="tag">&lt;<span class="name">CMD</span> <span class="attr">state</span>=<span class="string">&quot;Updater&quot;</span> <span class="attr">type</span>=<span class="string">&quot;push&quot;</span> <span class="attr">body</span>=<span class="string">&quot;$ cp $FILE /mnt/mmcblk%mmc%p1/imx6ul%lite%-%6uldtb%.dtb&quot;</span> <span class="attr">ifdev</span>=<span class="string">&quot;MX6ULL&quot;</span>&gt;</span>write device tree to eMMC<span class="tag">&lt;/<span class="name">CMD</span>&gt;</span></span><br><span class="line"></span><br><span class="line">	<span class="tag">&lt;<span class="name">CMD</span> <span class="attr">state</span>=<span class="string">&quot;Updater&quot;</span> <span class="attr">type</span>=<span class="string">&quot;push&quot;</span> <span class="attr">body</span>=<span class="string">&quot;$ sleep 1&quot;</span>&gt;</span>delay<span class="tag">&lt;/<span class="name">CMD</span>&gt;</span></span><br><span class="line">	<span class="tag">&lt;<span class="name">CMD</span> <span class="attr">state</span>=<span class="string">&quot;Updater&quot;</span> <span class="attr">type</span>=<span class="string">&quot;push&quot;</span> <span class="attr">body</span>=<span class="string">&quot;$ sync&quot;</span>&gt;</span>Sync...<span class="tag">&lt;/<span class="name">CMD</span>&gt;</span></span><br><span class="line">	<span class="tag">&lt;<span class="name">CMD</span> <span class="attr">state</span>=<span class="string">&quot;Updater&quot;</span> <span class="attr">type</span>=<span class="string">&quot;push&quot;</span> <span class="attr">body</span>=<span class="string">&quot;$ umount /mnt/mmcblk%mmc%p1&quot;</span>&gt;</span>Unmounting vfat partition<span class="tag">&lt;/<span class="name">CMD</span>&gt;</span></span><br><span class="line"></span><br><span class="line">	<span class="comment">&lt;!-- burn rootfs --&gt;</span></span><br><span class="line">	<span class="tag">&lt;<span class="name">CMD</span> <span class="attr">state</span>=<span class="string">&quot;Updater&quot;</span> <span class="attr">type</span>=<span class="string">&quot;push&quot;</span> <span class="attr">body</span>=<span class="string">&quot;$ mkfs.ext3 -F -E nodiscard /dev/mmcblk%mmc%p2&quot;</span>&gt;</span>Formatting rootfs partition<span class="tag">&lt;/<span class="name">CMD</span>&gt;</span></span><br><span class="line">	<span class="tag">&lt;<span class="name">CMD</span> <span class="attr">state</span>=<span class="string">&quot;Updater&quot;</span> <span class="attr">type</span>=<span class="string">&quot;push&quot;</span> <span class="attr">body</span>=<span class="string">&quot;$ mkdir -p /mnt/mmcblk%mmc%p2&quot;</span>/&gt;</span></span><br><span class="line">	<span class="tag">&lt;<span class="name">CMD</span> <span class="attr">state</span>=<span class="string">&quot;Updater&quot;</span> <span class="attr">type</span>=<span class="string">&quot;push&quot;</span> <span class="attr">body</span>=<span class="string">&quot;$ mount -t ext3 /dev/mmcblk%mmc%p2 /mnt/mmcblk%mmc%p2&quot;</span>/&gt;</span></span><br><span class="line">	<span class="tag">&lt;<span class="name">CMD</span> <span class="attr">state</span>=<span class="string">&quot;Updater&quot;</span> <span class="attr">type</span>=<span class="string">&quot;push&quot;</span> <span class="attr">body</span>=<span class="string">&quot;pipe tar -jxv -C /mnt/mmcblk%mmc%p2&quot;</span> <span class="attr">file</span>=<span class="string">&quot;files/rootfs_nogpu.tar.bz2&quot;</span> <span class="attr">ifdev</span>=<span class="string">&quot;MX6UL MX7D MX6ULL&quot;</span>&gt;</span>Sending and writting rootfs<span class="tag">&lt;/<span class="name">CMD</span>&gt;</span></span><br><span class="line">	<span class="tag">&lt;<span class="name">CMD</span> <span class="attr">state</span>=<span class="string">&quot;Updater&quot;</span> <span class="attr">type</span>=<span class="string">&quot;push&quot;</span> <span class="attr">body</span>=<span class="string">&quot;frf&quot;</span>&gt;</span>Finishing rootfs write<span class="tag">&lt;/<span class="name">CMD</span>&gt;</span></span><br><span class="line">	<span class="tag">&lt;<span class="name">CMD</span> <span class="attr">state</span>=<span class="string">&quot;Updater&quot;</span> <span class="attr">type</span>=<span class="string">&quot;push&quot;</span> <span class="attr">body</span>=<span class="string">&quot;$ umount /mnt/mmcblk%mmc%p2&quot;</span>&gt;</span>Unmounting rootfs partition<span class="tag">&lt;/<span class="name">CMD</span>&gt;</span></span><br><span class="line">	<span class="tag">&lt;<span class="name">CMD</span> <span class="attr">state</span>=<span class="string">&quot;Updater&quot;</span> <span class="attr">type</span>=<span class="string">&quot;push&quot;</span> <span class="attr">body</span>=<span class="string">&quot;$ echo Update Complete!&quot;</span>&gt;</span>Done<span class="tag">&lt;/<span class="name">CMD</span>&gt;</span></span><br><span class="line">  <span class="tag">&lt;/<span class="name">LIST</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">UCL</span>&gt;</span></span><br><span class="line"></span><br></pre></td></tr></table></figure>
              </div>
            </details>

<p>【注意】上边的文件中，%mmc%将会被替换为1，lite&#x3D;”l”（小写的L）， 6uldtb&#x3D;”14x14-evk”，6uluboot&#x3D;”14x14evk”。</p>
<h2 id="3-烧写测试"><a href="#3-烧写测试" class="headerlink" title="3. 烧写测试"></a><font size=3>3. 烧写测试</font></h2><p>这里就按照之前烧写官方系统的时候的方式就可以了，直接双击 mfgtool2-yocto-mx-evk-emmc.vbs 文件，开发板确保已经连接到电脑，便会打开mfgtool：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-02-NXP-mfgtool%E7%AE%80%E4%BB%8B/img/image-20221023154920830.png" alt="image-20221023154920830" style="zoom:50%;" />

<p>然后我们点击【Start 】等待烧写完毕。</p>
<h2 id="4-重启测试"><a href="#4-重启测试" class="headerlink" title="4. 重启测试"></a><font size=3>4. 重启测试</font></h2><p>上边烧写完毕后，我们拔出 USB 线，将开发板上的拨码开关拨到 EMMC 启动模式，然后重启开发板，此时就会从 EMMC 启动。若是烧写成功的话，就会看到与上边NXP官方系统烧写一节的笔记中一样的情况：</p>
<img data-src="https://fanhua-picture.oss-cn-hangzhou.aliyuncs.com/01%E5%B5%8C%E5%85%A5%E5%BC%8F%E5%BC%80%E5%8F%91/02IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/LV01-02-IMX6ULL-ALPHA%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BD%93%E9%AA%8C-02-NXP-mfgtool%E7%AE%80%E4%BB%8B/img/image-20230715102654342.png" alt="image-20230715102654342" style="zoom:50%;" />

<p>能到这一步，说明我们改造的mfgtool可以正常使用。</p>
<blockquote>
<p>参考资料</p>
<p><a target="_blank" rel="noopener" href="https://www.forlinx.com/article-new-c22/367.html">技术分享-NXP MFGTool软件烧录原理 - 飞凌嵌入式行业资讯 - 保定飞凌嵌入式技术有限公司 (forlinx.com)</a></p>
<p><a target="_blank" rel="noopener" href="https://doc.embedfire.com/linux/imx6/base/zh/latest/building_image/burning_NXP_firmware.html">doc.embedfire.com&#x2F;linux&#x2F;imx6&#x2F;base&#x2F;zh&#x2F;latest&#x2F;building_image&#x2F;burning_NXP_firmware.html</a></p>
</blockquote>

    </div>

    
    
    

    <footer class="post-footer">




    <div>
        
            <div style="text-align:center;color: #ccc;font-size:14px;">
            ----------本文结束
            <i class="fas fa-fan fa-spin" style="color: #FF1493; font-size: 1rem"></i>
            感谢您的阅读----------
            </div>
        
    </div>





  
  <div class="my_post_copyright"> 
    <p><span>文章标题:</span><a href="/post/95616702.html">LV01-02-IMX6ULL-ALPHA开发板体验-02-NXP-mfgtool简介</a></p>
    <p><span>文章作者:</span><a href="/" title="欢迎访问 《苏木》 的学习笔记">苏木</a></p>
    <p><span>发布时间:</span>2023年09月08日 - 19:25</p>
    <p><span>最后更新:</span>2025年06月14日 - 00:25</p>
    <p><span>原始链接:</span><a href="/post/95616702.html" title="LV01-02-IMX6ULL-ALPHA开发板体验-02-NXP-mfgtool简介">https://sumumm.github.io/post/95616702.html</a></p>
    <p><span>许可协议:</span><i class="fab fa-creative-commons"></i> <a rel="license" href= "https://creativecommons.org/licenses/by-nc-nd/4.0/" target="_blank" title="Attribution-NonCommercial-NoDerivatives 4.0 International (CC BY-NC-ND 4.0)">署名-非商业性使用-禁止演绎 4.0 国际</a> 转载请保留原文链接及作者。</p>  
  </div>
  


          <div class="post-tags">
              <a href="/tags/ALPHA-LV01-IMX6ULL%E5%B9%B3%E5%8F%B0/" rel="tag"><i class="fa fa-tag"></i> (ALPHA)LV01-IMX6ULL平台</a>
          </div>

        

          <div class="post-nav">
            <div class="post-nav-item">
                <a href="/post/c60bf741.html" rel="prev" title="LV01-02-IMX6ULL-ALPHA开发板体验-03-开发板系统烧写">
                  <i class="fa fa-angle-left"></i> LV01-02-IMX6ULL-ALPHA开发板体验-03-开发板系统烧写
                </a>
            </div>
            <div class="post-nav-item">
                <a href="/post/5f02b2ff.html" rel="next" title="LV01-02-IMX6ULL-ALPHA开发板体验-01-环境准备">
                  LV01-02-IMX6ULL-ALPHA开发板体验-01-环境准备 <i class="fa fa-angle-right"></i>
                </a>
            </div>
          </div>
    </footer>
  </article>
</div>






</div>
  </main>

  <footer class="footer">
    <div class="footer-inner">

  <div class="copyright">
    &copy; 2017 – 
    <span itemprop="copyrightYear">2025</span>
    <span class="with-love">
      <i class="fa fa-heart"></i>
    </span>
    <span class="author" itemprop="copyrightHolder">苏木</span>
  </div>
<div class="wordcount">
  <span class="post-meta-item">
    <span class="post-meta-item-icon">
      <i class="fa fa-chart-line"></i>
    </span>
      <span>站点总字数：</span>
    <span title="站点总字数">3.7m</span>
  </span>
  <span class="post-meta-item">
    <span class="post-meta-item-icon">
      <i class="fa fa-coffee"></i>
    </span>
      <span>站点阅读时长 &asymp;</span>
    <span title="站点阅读时长">225:26</span>
  </span>
</div>




    <span id="sitetime"></span>
    <script defer language=javascript>
        function siteTime()
        {
            window.setTimeout("siteTime()", 1000);
            var seconds = 1000;
            var minutes = seconds * 60;
            var hours = minutes * 60;
            var days = hours * 24;
            var years = days * 365;
            var today = new Date();
            var todayYear = today.getFullYear();
            var todayMonth = today.getMonth()+1;
            var todayDate = today.getDate();
            var todayHour = today.getHours();
            var todayMinute = today.getMinutes();
            var todaySecond = today.getSeconds();
            /*==================================================
            Date.UTC() -- 返回date对象距世界标准时间(UTC)1970年1月1日午夜之间的毫秒数(时间戳)
            year        - 作为date对象的年份，为4位年份值
            month       - 0-11之间的整数，做为date对象的月份
            day         - 1-31之间的整数，做为date对象的天数
            hours       - 0(午夜24点)-23之间的整数，做为date对象的小时数
            minutes     - 0-59之间的整数，做为date对象的分钟数
            seconds     - 0-59之间的整数，做为date对象的秒数
            microseconds - 0-999之间的整数，做为date对象的毫秒数
            ==================================================*/
            var t1 = Date.UTC(2017, 
                              5, 
                              19, 
                              0, 
                              0, 
                              0); //北京时间
            var t2 = Date.UTC(todayYear,todayMonth,todayDate,todayHour,todayMinute,todaySecond);
            var diff = t2-t1;
            var diffYears = Math.floor(diff/years);
            var diffDays = Math.floor((diff/days)-diffYears*365);
            var diffHours = Math.floor((diff-(diffYears*365+diffDays)*days)/hours);
            var diffMinutes = Math.floor((diff-(diffYears*365+diffDays)*days-diffHours*hours)/minutes);
            var diffSeconds = Math.floor((diff-(diffYears*365+diffDays)*days-diffHours*hours-diffMinutes*minutes)/seconds);
            document.getElementById("sitetime").innerHTML="已在这里 "+diffYears+" 年 "+diffDays+" 天 "+diffHours+" 小时 "+diffMinutes+" 分钟 "+diffSeconds+" 秒";
        }
        siteTime();
    </script>



    </div>
  </footer>

  
  <div class="back-to-top" role="button" aria-label="返回顶部">
    <i class="fa fa-arrow-up fa-lg"></i>
    <span>0%</span>
  </div>
  <div class="reading-progress-bar"></div>

<noscript>
  <div class="noscript-warning">Theme NexT works best with JavaScript enabled</div>
</noscript>


  
  <script src="https://cdnjs.cloudflare.com/ajax/libs/animejs/3.2.1/anime.min.js" integrity="sha256-XL2inqUJaslATFnHdJOi9GfQ60on8Wx1C2H8DYiN1xY=" crossorigin="anonymous"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/next-theme-pjax/0.6.0/pjax.min.js" integrity="sha256-vxLn1tSKWD4dqbMRyv940UYw4sXgMtYcK6reefzZrao=" crossorigin="anonymous"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/fancyapps-ui/5.0.28/fancybox/fancybox.umd.js" integrity="sha256-ytMJGN3toR+a84u7g7NuHm91VIR06Q41kMWDr2pq7Zo=" crossorigin="anonymous"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/lozad.js/1.16.0/lozad.min.js" integrity="sha256-mOFREFhqmHeQbXpK2lp4nA3qooVgACfh88fpJftLBbc=" crossorigin="anonymous"></script>
<script src="/js/comments.js"></script><script src="/js/utils.js"></script><script src="/js/motion.js"></script><script src="/js/next-boot.js"></script><script src="/js/pjax.js"></script>

  <script src="https://cdnjs.cloudflare.com/ajax/libs/hexo-generator-searchdb/1.4.1/search.js" integrity="sha256-1kfA5uHPf65M5cphT2dvymhkuyHPQp5A53EGZOnOLmc=" crossorigin="anonymous"></script>
<script src="/js/third-party/search/local-search.js"></script>




  <script src="/js/third-party/fancybox.js"></script>

  <script src="/js/third-party/pace.js"></script>


  




  

  <script class="next-config" data-name="enableMath" type="application/json">true</script><script class="next-config" data-name="mathjax" type="application/json">{"enable":true,"tags":"none","js":{"url":"https://cdnjs.cloudflare.com/ajax/libs/mathjax/3.2.2/es5/tex-mml-chtml.js","integrity":"sha256-MASABpB4tYktI2Oitl4t+78w/lyA+D7b/s9GEP0JOGI="}}</script>
<script src="/js/third-party/math/mathjax.js"></script>


 
        <div id="click-show-text"
            data-mobile = false
            data-text = 富强,民主,文明,和谐,自由,平等,公正,法制,爱国,敬业,诚信,友善
            data-fontsize = 15px
            data-random= false>
        </div>
       

      
        <script async src=https://cdn.jsdelivr.net/npm/hexo-next-mouse-effect@latest/click/showText.js></script>
      

      
    




    <script async src="/js/fancybox_param.js"></script>





<!-- APlayer本体 -->



</body>
</html>
